Skip to content

Instantly share code, notes, and snippets.

@etluchs
Created April 7, 2012 18:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save etluchs/2331186 to your computer and use it in GitHub Desktop.
Save etluchs/2331186 to your computer and use it in GitHub Desktop.
simple interactive test for completing parser
object CompletingParserTestApp extends TestParser with App {
println( "Type something and hit enter" );
var input = ""
do {
input = readLine();
parseAll( propertyPath, input ) match {
case s : Success[Any] => println ( "valid, parsed as "+ s.get)
case MissingCompletionOrFailure( completions, msg, in)
=> if ( completions.isEmpty )
println( msg )
else {
println( "possible completions: ");
for ( c <- completions ) println( input + c )
}
}
}
while ( input != "" )
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment