Guest User

Untitled

a guest
Jul 19th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.48 KB | None | 0 0
  1. grammar alsastates;
  2.  
  3. options {
  4. language = Java;
  5. }
  6.  
  7. tokens {
  8. APOS = '\'' ;
  9. CONTROL = 'control' ;
  10. }
  11.  
  12. carddef : (Text '.' Text '{' ctrldef* '}') EOF ;
  13.  
  14. ctrldef : (CONTROL '.' Index '{' (iface|name|value|index|comment)+ '}' )+ ;
  15.  
  16. iface : 'iface' Text ;
  17. name : 'name' TextAPOS ;
  18. value : 'value' ( '.' Index)? (Text|Index|TextAPOS)+ ;
  19.  
  20.  
  21. index : 'index' Index ;
  22. comment : 'comment' '{' com_access
  23. | com_type
  24. | com_count
  25. | com_range
  26. | com_dbmin
  27. | com_dbmax
  28. | com_item
  29. | com_tlv
  30. | (com_dbvalue)+
  31.  
  32. '}' ;
  33. // | (Text|Index|'-'|'+'|'.'|TextAPOS)* '}' ;
  34.  
  35. com_access : 'access' (Text|Index|TextAPOS)+ ;
  36. com_type : 'type' ('INTEGER' | 'BOOLEAN' | 'ENUMERATED' | 'IEC958') ;
  37. com_count : 'count' Index ;
  38. com_range : 'range' TextAPOS ;
  39. com_dbmin : 'dbmin' (Minus)? Index ;
  40. com_dbmax : 'dbmax' (Minus)? Index ;
  41. com_dbvalue : 'dbvalue' ('.' Index)? Index ;
  42. com_item : 'item' ('.' Index)? ((Text)+|TextAPOS) ;
  43. com_tlv : 'tlv' TextAPOS ;
  44.  
  45.  
  46. Index : (Digit)+ ;
  47.  
  48. Text : (Letter|Digit)+ ;
  49. TextAPOS : APOS (Text|S|'-')+ APOS;
  50. fragment Minus: '-' ;
  51. fragment Digit: '0'..'9' ;
  52. fragment Letter : ('a'..'z'|'A'..'Z') ;
  53.  
  54. fragment S : ' ';
  55. WS : (' '|'\n'|'\r'|'\t')+ {$channel=HIDDEN;} ;
Add Comment
Please, Sign In to add comment