diff --git a/README.html b/README.html index 4ccb1dc2..097a0848 100644 --- a/README.html +++ b/README.html @@ -675,14 +675,23 @@ For example, to parse a file and print all variable names, use code like: Chunk chunk = parser.Chunk(); chunk.accept( new Visitor() { public void visit(Exp.NameExp exp) { - System.out.println("Name in use: "+exp.name.name); + System.out.println("Name in use: "+exp.name.name + +" line "+exp.beginLine + +" col "+exp.beginColumn); } } ); } catch ( ParseException e ) { - System.out.println( "parse failed: "+e ); + System.out.println( "parse failed: "+e + +" line "+e.currentToken.beginLine + +" col "+e.currentToken.beginColumn); } +An example that prints locations of all function definitions in a file may be found in +
+ examples/jse/SampleParser.java ++
See the org.luaj.vm2.ast package javadoc for the API relating to the syntax tree that is produced. @@ -764,6 +773,7 @@ and LuaForge: