Introduction

This section gives the details of the yacc grammar used to build the admst path parser. The admst path is very similar to the xml xpath language. In future releases of adms we plan to substitute the admst path by the xml xpath language. Lot of development is on going on importing the xpath technology to adms.

Example

Some examples of valid admst paths

admst path: examples

admst path description
/module select all modules
node[location='external'] select nodes the position of which is external - in other words select terminals
node[location='external' or name='gate'] select terminal the name of which is 'gate'

admst path: Grammar Definition

The admst path grammar description is very simple. This is due to the limitations of the method applied to build the parser into adms (predicative parser). But it is good enough for most of the current applications that use adms.

admst path: lexical terminals

admst path: lexical terminals

terminal regexp description
notequal != Boolean not-equal
gt > Boolean gt
lt < Boolean lt
star * used to select all children
incrp ++ Arithmetic increment
incrm -- Arithmetic decrement
addp + Arithmetic addition
column : Arithmetic divide
comma , comma
bar | bar
addm - Arithmetic substraction
dotdot .. selector of previous admst transform
dot . selector of current admst transform
slash / separator between two admstpath items
equal = Boolean equal
openCond [ open admstpath condition
closeCond ] close admstpath condition
admst admst function: return admst element
and and Boolean and
count count function: return count of argument
exists exists function: return 1 if argument is exists
false false false() function
id id function: generates unique id of argument
index index function: return position if second argument inside first argument
isdefault isdefault function: return 1 if argument has default value
lower_mcase lower-case function: returns argument converted to upper-case string
nilled nilled function: return 1 if argument is nilled
not not inverse Boolean value of admstpath condition
or or Boolean or
position position function: return position of argument
returned returned function: return value from admst:apply-templates
reverse reverse function: reverse order
sort sort function: sort in dictionary order
text text function: prints first argument using format specified in second argument
true true true() function
uid uid function: return uid of element
upper_mcase upper-case function: returns argument converted to upper-case string
openE else if(!strncmp(t,"(",1)) { t+=1, mypparse->_tkid=tktk_openE; paren++; }
closeE else if(!strncmp(t,")",1)) { if(PARENMATCH) { t+=1, mypparse->_tkid=tktk_closeE, adms_slist_pull(&parenidx); adms_slist_pull(&globalctxt); } else t+=1, mypparse->_tkid=tktk_closeE; paren--; }
dollarvariable else if(*t=='$'&&*(t+1)=='(') { t++; t++; paren++; adms_slist_push(&parenidx,(p_adms)(long)paren); SETTEXT mypparse->_tkid=tktk_dollarvariable; }
kdollarvariable else if(*t=='$') { t++; while(isalnum(*t)||*t=='_') t++; mypparse->_tkstart=tstart+1; mypparse->_tklen=(int)(long)(t-(tstart+1)); mypparse->_tkid=tktk_kdollarvariable; }
arobavariable else if(*t=='@'&&*(t+1)=='(') { t++; t++; paren++; adms_slist_push(&parenidx,(p_adms)(long)paren); SETTEXT mypparse->_tkid=tktk_arobavariable; }
karobavariable else if(*t=='@') { t++; while(isalnum(*t)||*t=='_') t++; mypparse->_tkstart=tstart+1; mypparse->_tklen=(int)(long)(t-(tstart+1)); mypparse->_tkid=tktk_karobavariable; }
croixcroixvariable else if(*t=='#'&&*(t+1)=='#'&&*(t+2)=='(') { t++; t++; t++; paren++; adms_slist_push(&parenidx,(p_adms)(long)paren); SETTEXT mypparse->_tkid=tktk_croixcroixvariable; }
croixstar else if(*t=='#'&&*(t+1)=='*') { t++; t++; while(isalnum(*t)||*t=='_') t++; mypparse->_tkstart=tstart+1; mypparse->_tklen=(int)(long)(t-(tstart+1)); mypparse->_tkid=tktk_croixstar; }
kcroixcroixvariable else if(*t=='#'&&*(t+1)=='#') { t++; t++; while(isalnum(*t)||*t=='_') t++; mypparse->_tkstart=tstart+1; mypparse->_tklen=(int)(long)(t-(tstart+1)); mypparse->_tkid=tktk_kcroixcroixvariable; }
croixvariable else if(*t=='#'&&*(t+1)=='(') { t++; t++; paren++; adms_slist_push(&parenidx,(p_adms)(long)paren); SETTEXT mypparse->_tkid=tktk_croixvariable; }
kcroixvariable else if(*t=='#') { t++; while(isalnum(*t)||*t=='_') t++; mypparse->_tkstart=tstart+1; mypparse->_tklen=(int)(long)(t-(tstart+1)); mypparse->_tkid=tktk_kcroixvariable; }
oquote else if(*t=='\'') { SETTIC t+=1, mypparse->_tkid=tktk_oquote; }
ident else if(isalpha(*t)) { while(isalnum(*t)||*t=='_'||*t==':') t++; mypparse->_tkid=tktk_ident; mypparse->_tkstart=tstart; mypparse->_tklen=(int)(long)(t-tstart); }
real integer else if(isdigit(*t)) { while(isdigit(*t)) t++; if(*t=='.') { t++; while(isdigit(*t)) t++; mypparse->_tkid=tktk_real; mypparse->_tkstart=tstart; mypparse->_tklen=(int)(long)(t-tstart); } else { mypparse->_tkid=tktk_integer; mypparse->_tkstart=tstart; mypparse->_tklen=(int)(long)(t-tstart); } }

This page has been automatically created by applying the xsl transform admstpathstyle.xsl to the xml data file admstpath.xml.
The rendering of the page is specified by the css stylesheet adms.css. You can get the full contents of data file admstpath.xml by viewing the source of the document from your web browser. Please address any comments to r29173.