This repo contains code to mirror other repos. It also contains the code that is getting mirrored.
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

51 rader
1.0 KiB

  1. start: (_item | _NL)*
  2. _item: rule
  3. | token
  4. | statement
  5. rule: RULE priority? ":" expansions _NL
  6. token: TOKEN priority? ":" expansions _NL
  7. priority: "." NUMBER
  8. statement: "%ignore" expansions _NL -> ignore
  9. | "%import" import_args ["->" name] _NL -> import
  10. | "%declare" name+ -> declare
  11. import_args: "."? name ("." name)*
  12. ?expansions: alias (_VBAR alias)*
  13. ?alias: expansion ["->" RULE]
  14. ?expansion: expr*
  15. ?expr: atom [OP | "~" NUMBER [".." NUMBER]]
  16. ?atom: "(" expansions ")"
  17. | "[" expansions "]" -> maybe
  18. | STRING ".." STRING -> literal_range
  19. | name
  20. | (REGEXP | STRING) -> literal
  21. name: RULE
  22. | TOKEN
  23. _VBAR: _NL? "|"
  24. OP: /[+*][?]?|[?](?![a-z])/
  25. RULE: /!?[_?]?[a-z][_a-z0-9]*/
  26. TOKEN: /_?[A-Z][_A-Z0-9]*/
  27. STRING: _STRING "i"?
  28. REGEXP: /\/(?!\/)(\\\/|\\\\|[^\/\n])*?\/[imslux]*/
  29. _NL: /(\r?\n)+\s*/
  30. %import common.ESCAPED_STRING -> _STRING
  31. %import common.INT -> NUMBER
  32. %import common.WS_INLINE
  33. COMMENT: "//" /[^\n]/*
  34. %ignore WS_INLINE
  35. %ignore COMMENT