Mercurial > repos > tabletprog
changeset 244:ae5188be523e
Improve compatibility of new parser with the old one
author | Mike Pavone <pavone@retrodev.com> |
---|---|
date | Mon, 06 Jan 2014 00:48:19 -0800 |
parents | 5b830147c1cd |
children | 3590ecca6bc9 |
files | modules/parser.tp |
diffstat | 1 files changed, 28 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/modules/parser.tp Sun Jan 05 23:07:26 2014 -0800 +++ b/modules/parser.tp Mon Jan 06 00:48:19 2014 -0800 @@ -701,7 +701,6 @@ if: (Suffix from: 0 withLength: 1) = "u" { signed <- false } - print: (Suffix from: 1) . "\n" litbits <- (Suffix from: 1) int32 } #{ @@ -784,8 +783,11 @@ funcall <- match: hws . Initial . Parts where: { Initial <- match: namepart - Parts <- onePlus: argpart + Parts <- zeroPlus: argpart } yield: { + if: (Parts length) = 0 { + Parts <- [] + } Initial | Parts foldr: #{ name <- "" args <- [] @@ -902,8 +904,22 @@ Expr } + opsym <- match: Name where: { + Name <- matchOne: ["&&" "||" "<=" ">=" "<" ">" "=" "!=" "=" "-" "." "*" "/" "%" "|"] + } yield: { + #{ + name <- Name + string <- { + name + } + } + } + assignment <- match: ws . Symbol . hws . "<-" . Expr where: { - Symbol <- match: symexpr + Symbol <- matchOne: [ + symexpr + opsym + ] Expr <- match: expr } yield: { #{ @@ -916,8 +932,16 @@ } object <- match: "#{" . ws . Messages . "}" where: { - Messages <- zeroPlus: assignment + Messages <- zeroPlus: (match: ws . El where: { + El <- matchOne: [ + assignment + funcall + ] + } yield: { El }) } yield: { + if: (Messages length) = 0 { + Messages <- [] + } #{ messages <- Messages string <- {