Skip to content

Commit

Permalink
Backport Allow negative constant at parsing + \r fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
pirbo committed Sep 19, 2014
1 parent 558adbf commit 8b41784
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
7 changes: 3 additions & 4 deletions grammar/kappaLexer.mll
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@
}

let blank = [' ' '\t']
let integer = (['0'-'9']+)
let real =
let integer = '-'? (['0'-'9']+)
let real = '-'?
(((['0'-'9']+ | ['0'-'9']+ '.' ['0'-'9']*) | (['0'-'9']* '.' ['0'-'9']+)) ((['e' 'E'] ['+' '-'] ['0'-'9']+) | (['e' 'E'] ['0'-'9']+)))
| ((['0'-'9']+ '.' ['0'-'9']*) | (['0'-'9']* '.' ['0'-'9']+))
let id = (['a'-'z' 'A'-'Z'] ['a'-'z' 'A'-'Z' '0'-'9' '_' '-' '+']*)
Expand Down Expand Up @@ -98,8 +98,7 @@ rule token = parse
| ':' {TYPE}
| ';' {SEMICOLON}
| '\"' {let str = read_label "" ['\"'] lexbuf in let pos = position lexbuf in STRING (str,pos)}
| '\n' {incr_line lexbuf ; NEWLINE}
| '\r' {NEWLINE}
| '\r'? '\n' {incr_line lexbuf ; NEWLINE}
| '#' {comment lexbuf}
| integer as n {let pos = position lexbuf in INT (int_of_string n,pos)}
| real as f {let pos = position lexbuf in FLOAT (float_of_string f,pos)}
Expand Down
2 changes: 1 addition & 1 deletion main/main.ml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ open Mods
open State
open Random_tree

let version = "3.5-160514"
let version = "3.5-190914"

let usage_msg = "KaSim "^version^": \n"^"Usage is KaSim -i input_file [-e events | -t time] [-p points] [-o output_file]\n"
let version_msg = "Kappa Simulator: "^version^"\n"
Expand Down

0 comments on commit 8b41784

Please sign in to comment.