Skip to content

Instantly share code, notes, and snippets.

@oschrenk
Created September 16, 2012 11:59
Show Gist options
  • Save oschrenk/3732131 to your computer and use it in GitHub Desktop.
Save oschrenk/3732131 to your computer and use it in GitHub Desktop.
lingwah 0.91 calulator example problems
doMatch(expr,0)
/doMatch
doMatch(decimal,0)
/doMatch
doMatch(operator,0)
/doMatch
doMatch(group,0)
/doMatch
doMatch(optional(string('-')),0)
/doMatch
doMatch(multiplication,0)
/doMatch
doMatch(division,0)
/doMatch
doMatch(addition,0)
/doMatch
doMatch(subtraction,0)
/doMatch
doMatch(string('('),0)
/doMatch
doMatch(sequence(sequence(number, optional(sequence(string('.'), optional(number))))),0)
/doMatch
doMatch(string('-'),0)
/doMatch
doMatch(sequence(number, optional(sequence(string('.'), optional(number)))),0)
/doMatch
doMatch(number,0)
/doMatch
doMatch(digit,0)
/doMatch
doMatch(sequence(optional(sequence(string('.'), optional(number)))),1)
/doMatch
doMatch(digit,1)
/doMatch
doMatch(optional(sequence(string('.'), optional(number))),1)
/doMatch
doMatch(sequence(optional(ws), string('/'), optional(ws), expr),1)
/doMatch
doMatch(sequence(optional(ws), string('*'), optional(ws), expr),1)
/doMatch
doMatch(sequence(optional(ws), string('-'), optional(ws), expr),1)
/doMatch
doMatch(sequence(optional(ws), string('+'), optional(ws), expr),1)
/doMatch
doMatch(sequence(string('.'), optional(number)),1)
/doMatch
doMatch(optional(ws),1)
/doMatch
doMatch(optional(ws),1)
/doMatch
doMatch(optional(ws),1)
/doMatch
doMatch(optional(ws),1)
/doMatch
doMatch(string('.'),1)
/doMatch
doMatch(sequence(string('/'), optional(ws), expr),1)
/doMatch
doMatch(ws,1)
/doMatch
doMatch(sequence(string('*'), optional(ws), expr),1)
/doMatch
doMatch(sequence(string('-'), optional(ws), expr),1)
/doMatch
doMatch(sequence(string('+'), optional(ws), expr),1)
/doMatch
doMatch(string('/'),1)
/doMatch
doMatch(choice(repeat(regex('[
]')), inline_comment),1)
/doMatch
doMatch(string('*'),1)
/doMatch
doMatch(string('-'),1)
/doMatch
doMatch(string('+'),1)
/doMatch
doMatch(repeat(regex('[
]')),1)
/doMatch
doMatch(inline_comment,1)
/doMatch
doMatch(regex('[
]'),1)
/doMatch
doMatch(string('/*'),1)
/doMatch
doMatch(sequence(string('*'), optional(ws), expr),2)
/doMatch
doMatch(sequence(string('-'), optional(ws), expr),2)
/doMatch
doMatch(sequence(string('/'), optional(ws), expr),2)
/doMatch
doMatch(sequence(string('+'), optional(ws), expr),2)
/doMatch
doMatch(choice(repeat(regex('[
]')), inline_comment),2)
/doMatch
doMatch(regex('[
]'),2)
/doMatch
doMatch(string('*'),2)
/doMatch
doMatch(string('-'),2)
/doMatch
doMatch(string('/'),2)
/doMatch
doMatch(string('+'),2)
/doMatch
doMatch(repeat(regex('[
]')),2)
/doMatch
doMatch(inline_comment,2)
/doMatch
doMatch(sequence(optional(ws), expr),3)
/doMatch
doMatch(string('/*'),2)
/doMatch
doMatch(optional(ws),3)
/doMatch
doMatch(sequence(expr),3)
/doMatch
doMatch(ws,3)
/doMatch
doMatch(expr,3)
/doMatch
doMatch(choice(repeat(regex('[
]')), inline_comment),3)
/doMatch
doMatch(decimal,3)
/doMatch
doMatch(operator,3)
/doMatch
doMatch(group,3)
/doMatch
doMatch(repeat(regex('[
]')),3)
/doMatch
doMatch(inline_comment,3)
/doMatch
doMatch(optional(string('-')),3)
/doMatch
doMatch(multiplication,3)
/doMatch
doMatch(division,3)
/doMatch
doMatch(addition,3)
/doMatch
doMatch(subtraction,3)
/doMatch
doMatch(string('('),3)
/doMatch
doMatch(regex('[
]'),3)
/doMatch
doMatch(string('/*'),3)
/doMatch
doMatch(sequence(sequence(number, optional(sequence(string('.'), optional(number))))),3)
/doMatch
doMatch(string('-'),3)
/doMatch
doMatch(sequence(expr),4)
/doMatch
doMatch(choice(repeat(regex('[
]')), inline_comment),4)
/doMatch
doMatch(regex('[
]'),4)
/doMatch
doMatch(sequence(number, optional(sequence(string('.'), optional(number)))),3)
/doMatch
doMatch(expr,4)
/doMatch
doMatch(repeat(regex('[
]')),4)
/doMatch
doMatch(inline_comment,4)
/doMatch
doMatch(number,3)
/doMatch
doMatch(decimal,4)
/doMatch
doMatch(operator,4)
/doMatch
doMatch(group,4)
/doMatch
doMatch(string('/*'),4)
/doMatch
doMatch(digit,3)
/doMatch
doMatch(optional(string('-')),4)
/doMatch
doMatch(multiplication,4)
/doMatch
doMatch(division,4)
/doMatch
doMatch(addition,4)
/doMatch
doMatch(subtraction,4)
/doMatch
doMatch(string('('),4)
/doMatch
doMatch(sequence(sequence(number, optional(sequence(string('.'), optional(number))))),4)
/doMatch
doMatch(string('-'),4)
/doMatch
doMatch(sequence(number, optional(sequence(string('.'), optional(number)))),4)
/doMatch
doMatch(number,4)
/doMatch
doMatch(digit,4)
/doMatch
doMatch(sequence(optional(sequence(string('.'), optional(number)))),5)
/doMatch
doMatch(digit,5)
/doMatch
doMatch(optional(sequence(string('.'), optional(number))),5)
/doMatch
doMatch(sequence(optional(ws), string('*'), optional(ws), expr),5)
/doMatch
doMatch(sequence(optional(ws), string('/'), optional(ws), expr),5)
/doMatch
doMatch(sequence(optional(ws), string('-'), optional(ws), expr),5)
/doMatch
doMatch(sequence(optional(ws), string('+'), optional(ws), expr),5)
/doMatch
doMatch(sequence(string('.'), optional(number)),5)
/doMatch
doMatch(optional(ws),5)
/doMatch
doMatch(optional(ws),5)
/doMatch
doMatch(optional(ws),5)
/doMatch
doMatch(optional(ws),5)
/doMatch
doMatch(string('.'),5)
/doMatch
doMatch(sequence(string('*'), optional(ws), expr),5)
/doMatch
doMatch(ws,5)
/doMatch
doMatch(sequence(string('/'), optional(ws), expr),5)
/doMatch
doMatch(sequence(string('-'), optional(ws), expr),5)
/doMatch
doMatch(sequence(string('+'), optional(ws), expr),5)
/doMatch
doMatch(string('*'),5)
/doMatch
doMatch(choice(repeat(regex('[
]')), inline_comment),5)
/doMatch
doMatch(string('/'),5)
/doMatch
doMatch(string('-'),5)
/doMatch
doMatch(string('+'),5)
/doMatch
doMatch(repeat(regex('[
]')),5)
/doMatch
doMatch(inline_comment,5)
/doMatch
doMatch(regex('[
]'),5)
/doMatch
doMatch(string('/*'),5)
/doMatch
doMatch(sequence(string('-'), optional(ws), expr),6)
/doMatch
doMatch(sequence(string('/'), optional(ws), expr),6)
/doMatch
doMatch(sequence(string('*'), optional(ws), expr),6)
/doMatch
doMatch(sequence(string('+'), optional(ws), expr),6)
/doMatch
doMatch(choice(repeat(regex('[
]')), inline_comment),6)
/doMatch
doMatch(regex('[
]'),6)
/doMatch
doMatch(string('-'),6)
/doMatch
doMatch(string('/'),6)
/doMatch
doMatch(string('*'),6)
/doMatch
doMatch(string('+'),6)
/doMatch
doMatch(repeat(regex('[
]')),6)
/doMatch
doMatch(inline_comment,6)
/doMatch
doMatch(sequence(optional(ws), expr),7)
/doMatch
doMatch(string('/*'),6)
/doMatch
doMatch(optional(ws),7)
/doMatch
doMatch(sequence(expr),7)
/doMatch
doMatch(ws,7)
/doMatch
doMatch(expr,7)
/doMatch
doMatch(choice(repeat(regex('[
]')), inline_comment),7)
/doMatch
doMatch(decimal,7)
/doMatch
doMatch(operator,7)
/doMatch
doMatch(group,7)
/doMatch
doMatch(repeat(regex('[
]')),7)
/doMatch
doMatch(inline_comment,7)
/doMatch
doMatch(optional(string('-')),7)
/doMatch
doMatch(multiplication,7)
/doMatch
doMatch(division,7)
/doMatch
doMatch(addition,7)
/doMatch
doMatch(subtraction,7)
/doMatch
doMatch(string('('),7)
/doMatch
doMatch(regex('[
]'),7)
/doMatch
doMatch(string('/*'),7)
/doMatch
doMatch(sequence(sequence(number, optional(sequence(string('.'), optional(number))))),7)
/doMatch
doMatch(string('-'),7)
/doMatch
doMatch(sequence(expr),8)
/doMatch
doMatch(choice(repeat(regex('[
]')), inline_comment),8)
/doMatch
doMatch(regex('[
]'),8)
/doMatch
doMatch(sequence(number, optional(sequence(string('.'), optional(number)))),7)
/doMatch
doMatch(expr,8)
/doMatch
doMatch(repeat(regex('[
]')),8)
/doMatch
doMatch(inline_comment,8)
/doMatch
doMatch(number,7)
/doMatch
doMatch(decimal,8)
/doMatch
doMatch(operator,8)
/doMatch
doMatch(group,8)
/doMatch
doMatch(string('/*'),8)
/doMatch
doMatch(digit,7)
/doMatch
doMatch(optional(string('-')),8)
/doMatch
doMatch(multiplication,8)
/doMatch
doMatch(division,8)
/doMatch
doMatch(addition,8)
/doMatch
doMatch(subtraction,8)
/doMatch
doMatch(string('('),8)
/doMatch
doMatch(sequence(sequence(number, optional(sequence(string('.'), optional(number))))),8)
/doMatch
doMatch(string('-'),8)
/doMatch
doMatch(sequence(number, optional(sequence(string('.'), optional(number)))),8)
/doMatch
doMatch(number,8)
/doMatch
doMatch(digit,8)
/doMatch
doMatch(sequence(optional(sequence(string('.'), optional(number)))),9)
/doMatch
doMatch(digit,9)
/doMatch
doMatch(optional(sequence(string('.'), optional(number))),9)
/doMatch
doMatch(sequence(optional(ws), string('*'), optional(ws), expr),9)
/doMatch
doMatch(sequence(optional(ws), string('/'), optional(ws), expr),9)
/doMatch
doMatch(sequence(optional(ws), string('-'), optional(ws), expr),9)
/doMatch
doMatch(sequence(optional(ws), string('+'), optional(ws), expr),9)
/doMatch
doMatch(sequence(string('.'), optional(number)),9)
/doMatch
doMatch(optional(ws),9)
/doMatch
doMatch(optional(ws),9)
/doMatch
doMatch(optional(ws),9)
/doMatch
doMatch(optional(ws),9)
/doMatch
doMatch(string('.'),9)
/doMatch
doMatch(sequence(string('*'), optional(ws), expr),9)
/doMatch
doMatch(ws,9)
/doMatch
doMatch(sequence(string('/'), optional(ws), expr),9)
/doMatch
doMatch(sequence(string('-'), optional(ws), expr),9)
/doMatch
doMatch(sequence(string('+'), optional(ws), expr),9)
/doMatch
doMatch(string('*'),9)
/doMatch
doMatch(choice(repeat(regex('[
]')), inline_comment),9)
/doMatch
doMatch(string('/'),9)
/doMatch
doMatch(string('-'),9)
/doMatch
doMatch(string('+'),9)
/doMatch
doMatch(repeat(regex('[
]')),9)
/doMatch
doMatch(inline_comment,9)
/doMatch
doMatch(regex('[
]'),9)
/doMatch
doMatch(string('/*'),9)
/doMatch
Exception in thread "main" java.lang.RuntimeException: Error invoking method 'completeAddition'
at com.googlecode.lingwah.AbstractProcessor.complete(AbstractProcessor.java:65)
at com.googlecode.lingwah.Match.accept(Match.java:237)
at com.googlecode.lingwah.Match.accept(Match.java:235)
at com.googlecode.lingwah.Match.accept(Match.java:235)
at acme.CalculatorProcessor.process(CalculatorProcessor.java:59)
at acme.Calculator.parse(Calculator.java:16)
at acme.Calculator.main(Calculator.java:20)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at com.googlecode.lingwah.AbstractProcessor.complete(AbstractProcessor.java:59)
... 6 more
Caused by: java.lang.NullPointerException
at java.math.BigDecimal.add(BigDecimal.java:1083)
at acme.CalculatorProcessor.completeAddition(CalculatorProcessor.java:21)
... 11 more
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment