File: exprlex.mll

package info (click to toggle)
pxp 1.1.96-8
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 5,960 kB
  • ctags: 2,016
  • sloc: ml: 21,018; xml: 2,597; sh: 727; makefile: 706
file content (34 lines) | stat: -rw-r--r-- 536 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
(* $Id: exprlex.mll 662 2004-05-25 20:57:28Z gerd $
 * ----------------------------------------------------------------------
 *
 *)

{ open Expr }

rule scan_expr = parse
    [ ' ' '\t' ]+ 
      { Space }
  | '\013' '\010'
      { Newline }
  | '\013'
      { Newline }
  | '\010'
      { Newline }
  | [ '0'-'9' ]+
      { Number(int_of_string(Lexing.lexeme lexbuf)) }
  | '+'
      { Add }
  | '-'
      { Sub }
  | '*'
      { Mult }
  | '/'
      { Div }
  | '('
      { LParen }
  | ')'
      { RParen }
  | '}'
      { Stop }