#!/usr/bin/env icarus
# NCIMB Phages Catalogue - Syntax file
# Version 2004.12.17.01
# Last Updated December 17, 2004
# Author: Domenico Marra & Francesca Piersigilli & Paolo Romano
# (c) CABRI 1999-2023
$fn={
Collection_number:coll_no
Other_collection_numbers:other_nos
Name:name
Type:type
Restricted_distribution:rest_distrib
Literature:literature
History_of_deposit:history
Host_for_propagation:host_for_prop
Host_used_for_propagation:host_str
Lysogenicity:lyso
Virus_used_for:virus_for
}
$rules={
entry: ~ {$In:[file:text] $Out pre $Skip:0}
('Collection_number' {$Not} ln)*
('Collection_number' {$entryFip=$Fip $Wrt} ln {$App}
('Collection_number' {$Not} ln {$App})*)?
~
# fields
fields: ~ {$In:entry $Out $Skip:1}
(/\/[^\n]+\n/ {$Wrt} |
word {$Wrt:$fn.$Ct}
(/[\/A-Z]/ {$Not} ln {$App})+)+ ~
#indexing
coll_no: ~ {$In:[fields c:coll_no] $Out}
word ' '(word3{$Wrt} |punct4) ~
other_nos: ~ {$In:[fields c:other_nos] $Out}
word ' '(word3{$Wrt} |punct4) ~
name: ~ {$In:[fields c:name] $Out}
word ' '
(word {$Wrt:[s:$StrRep:[s:$Ct r:"[\/|\.|-]" to:""]]}
| punct)* ~
strX: ~ {$In:[fields c:{type class cons rest_distrib host_for_sel
vimor parsi plafo clepla cell_surf_rec minpac maxpac
remap cloge trans_el
start_codon further_inf rest_sites price_code medium
literature history host_for_prop lyso cell_surf_rec
host_str na_type virus_for }] $Out}
word (str{$Uniq:$Itc}| /./ |punct)* ~
#HTML stuff...
h_top: ~ {$In:[fields c:coll_no t:html] pre if:$ParInt:isTable $Fail}
word {$Rep:
|</TR><TR VALIGN=TOP>
|<TD colspan=2 bgcolor=\"#ffffff\">
|<font color=\"#000066\">
|<B>CABRI:($entry.libName)</B></TD>
|</TR>
|<TR VALIGN=TOP><TD bgcolor=\"#ffffff\">
|<font color=\"#000066\"><b><i>$Ct</i></b></font></TD>
|<TD bgcolor=\"#ffffff\">
}
':'? {$Rep:""} /.*/ {$Rep:"$Ct</TD></TR>"} ~
h_fields: ~ {$In:[fields t:html] pre if:$ParInt:isTable $Fail}
word {if:$isTable==0
$Rep:
|<TR VALIGN=TOP><TD bgcolor=\"#ffffff\">
|<font color=\"#000066\"><b><i>$Ct</i></b></font></TD>
|<TD bgcolor=\"#ffffff\">
} ':'? {$Rep:""} /.*/ {$Rep:"$Ct</TD></TR>"} ~
t_fields: ~ {$In:[fields] $Out} tag /.*/ {$Wrt:$Itc} ~
# definitions
tag: ~ word ':'?~
ln: ~/[^\n]*\n/ ~
word: ~/[0-9a-zA-Z_\/]+/ ~
str: ~/[a-zA-Z0-9&.'=\/\\%_-]+/ ~
punct: ~ /[ \t,;:\\.\\(\\)\\+\\*]+/ ~
punct4: ~ /[\t,;:\\.\\(\\)\\+\\*]+/ ~
word3: ~/[ 0-9a-zA-Z_\/\\(\\)-]+/ ~
}