~ubuntu-branches/ubuntu/karmic/ocaml-doc/karmic

« back to all changes in this revision

Viewing changes to examples/calc/lexer.mll

  • Committer: Bazaar Package Importer
  • Author(s): Vanicat Rémi
  • Date: 2002-02-05 10:51:43 UTC
  • Revision ID: james.westby@ubuntu.com-20020205105143-a061tunf8tev07ne
Tags: 3.04-4
* New debian maintainer
* Split doc-base file
* Move to non-free
* Change the copyright file to the copyright of the documentation
* remove FAQs (their license prohibit their redistribution)
* corrected the examples

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
{
 
2
open Parser;;        (* The type token is defined in parser.mli *)
 
3
exception Eof;;
 
4
}
 
5
rule token = parse
 
6
  | [' ' '\t']     { token lexbuf }     (* skip blanks *)
 
7
  | ['\n' ]        { EOL }
 
8
  | ['0'-'9']+     { INT(int_of_string (Lexing.lexeme lexbuf)) }
 
9
  | '+'            { PLUS }
 
10
  | '-'            { MINUS }
 
11
  | '*'            { TIMES }
 
12
  | '/'            { DIV }
 
13
  | '('            { LPAREN }
 
14
  | ')'            { RPAREN }
 
15
  | eof            { raise Eof }