# # # patch "selectors.g" # from [98a7d1fece832b1c074746554692188a80c21a42] # to [02e0422f2ec5c815c25fdb5b1fc5b969f98851d2] # ============================================================ --- selectors.g 98a7d1fece832b1c074746554692188a80c21a42 +++ selectors.g 02e0422f2ec5c815c25fdb5b1fc5b969f98851d2 @@ -1,44 +1,51 @@ grammar selectors; grammar selectors; -//setOperator : ( 'heads' | 'h' | 'erase_ancestors' | 'parent' | 'p' | 'leaves' ); +options { + language = C; +} -input : difference EOF; +input : sequence EOF; -difference : union ( '-' union )*; +sequence : addition ( ',' addition )*; -union : intersection ( ',' intersection )*; +addition : intersection ( ('+'|'~') intersection )*; -intersection : selector ( '/' selector )*; +intersection : antique ( ('^'|'&') antique )*; +antique : selector ( '/' selector )*; // 'antique' (c) Richard Levitte + selector : immediate -| '(' difference ')' +| '(' addition ')' //| Difference //| PrefixOperator -| function1 '(' difference ')' +| function1 '(' addition ')' //| Operator2 "(" Number10 "," Selector ")" ; immediate : Identifier -| BranchName -| AuthorName +| branchName +| authorName ; function1 : - 'h' | 'heads' + 'eca' | 'lca' -| 'p' | 'parents' +| 'parents' | 'p' +| 'ancestors' | 'anc' | 'a' +| 'union' | 'difference' | 'intersection' ; Identifier : 'i:' ('0'..'9'|'a'..'f'|'A'..'F')+; -BranchName : 'b:' ( - ('a'..'z'|'0'..'9'|'-'|'_'|'.'|'@')+ -| '"' (~('\r'|'\n'|'\t'|' '|'\''|'"'|'\\')|'\\' .)+ '"' -); +branchName : 'b:' anyString; +authorName : 'a:' anyString; + +anyString : StringLiteral | StringQuoted | Globish | PCRE; + +StringLiteral : ('a'..'z'|'0'..'9'|'-'|'_'|'.'|'@')+; +StringQuoted : '"' (~('"'|'\\')|'\\' .)+ '"'; +Globish : '<' (~('>'|'\\')|'\\' .)+ '>'; +PCRE : '#' (~('#'|'\\')|'\\' .)+ '#'; -AuthorName : 'a:' ( - ('a'..'z'|'0'..'9'|'-'|'_'|'.'|'@')+ -| '"' (~('\r'|'\n'|'\t'|' '|'\''|'"'|'\\')|'\\' .)+ '"' -);