Skip to content

Instantly share code, notes, and snippets.

@okomok
Created January 30, 2009 04:12
Show Gist options
  • Save okomok/54936 to your computer and use it in GitHub Desktop.
Save okomok/54936 to your computer and use it in GitHub Desktop.
LRule test
// Copyright Shunsuke Sogame 2008-2009.
// Distributed under the terms of an MIT-style license.
// See: "Packrat Parsers Can Support Left Recursion"
package madatest.peg
import mada.Peg._
import junit.framework.Assert._
import mada.Peg.Compatibles._
import mada.Vector.Compatibles._
class LRuleTest {
/*
val v = madaVector("1-2-3")
val lr = new mada.peg.LRules[Char]
val expr = lr.makeRule
val num = lr.makeRule
val x = lr.makeRule
def testTrivial: Unit = {
num ::= range('0','9')
expr ::= ( expr >> "-" >> num | num )
assertEquals(5, expr parse v)
}
def testIndirect: Unit = {
num ::= range('0', '9')
x ::= expr
expr ::= ( x >> "-" >> num | num )
assertEquals(5, expr parse v)
}
*/
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment