File: calc3.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-- 217 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#
# calc3.rex
# lexical scanner definition for rex
#

class Calculator3
macro
  BLANK         \s+
  DIGIT         \d+
rule
  {BLANK}
  {DIGIT}       { [:NUMBER, text.to_i] }
  .|\n          { [text, text] }
inner
end