File: error2.rex

package info (click to toggle)
rexical 1.0.8-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 316 kB
  • sloc: ruby: 1,124; makefile: 8; ansic: 5
file content (15 lines) | stat: -rw-r--r-- 269 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#
# error2.rex
# lexical definition sample for rex
#

class Error2
macro
  BLANK         [\ \t]+
rule
  {BLANK}       # no action
  \d+           { [:digit, text.to_i] }
  \w+           { [:word, text] }
  \n
  .             { self.state = :NONDEF ; [text, text] }
end