#!/usr/bin/env icarus
# DSMZ Plant Viruses 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={
Accession_number:acc_no
Virus_name:vir_name
Virus_name_abbreviation:vir_name_abbrev
Genus:genus
Reference:reference
Quarantine_regulations:quar_regs
Pathotype_serotype_strain:path_ser_strain
Former_name:former_name
Original_host_plant:ori_host_plant
Geographic_origin:geo_origin
Isolate_history:isol_history
Remarks:remarks
}
$rules={
entry: ~ {$In:[file:text] $Out pre $Skip:0}
('Accession_number' {$Not} ln)*
('Accession_number' {$entryFip=$Fip $Wrt} ln {$App}
('Accession_number' {$Not} ln {$App})*)?
~
# fields
fields: ~ {$In:entry $Out $Skip:1}
(/\/[^\n]+\n/ {$Wrt} |
word {$Wrt:$fn.$Ct}
(/[\/A-Z]/ {$Not} ln {$App})+)+ ~
#indexing
acc_no: ~ {$In:[fields c:acc_no] $Out}
word ' ' (word2{$Wrt} |punct2)* ~
vir_name_abbrev: ~ {$In:[fields c:vir_name_abbrev] $Out}
word (word {$Wrt:[s:$StrRep:[s:$Ct r:"[\/|\.|-]" to:""]]} |punct)* ~
genus: ~ {$In:[fields c:genus] $Out}
tag ln {$Uniq:$Itc} ~
strX: ~ {$In:[fields c:{vir_name reference quar_regs
path_ser_strain former_name ori_host_plant
geo_origin isol_history remarks}] $Out}
word (str{$Uniq:$Itc}| /./ |punct)* ~
#HTML stuff...
h_top: ~ {$In:[fields c:acc_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_\/]+/ ~
word2: ~/[ 0-9a-zA-Z_\\(\\)\/-]+/ ~
str: ~/[a-zA-Z0-9&.=\/\\%_-]+/ ~
punct: ~ /[ \t,;:\\.\\(\\)\\+\\*]+/ ~
punct2: ~ /[\t,;:\/\\+]+/ ~
}