Skip to content

Commit 3421142

Browse files
committed
Updated documentation slightly.
1 parent 7ff0891 commit 3421142

File tree

1 file changed

+15
-14
lines changed

1 file changed

+15
-14
lines changed

dumbParser.lua

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -28,63 +28,64 @@
2828
--------------------------------
2929
3030
tokenizeString()
31-
tokens, error = tokenizeString( luaString [, pathForErrors="?" ] )
31+
tokens, error = parser.tokenizeString( luaString [, pathForErrors="?" ] )
3232
Convert a Lua string into tokens.
3333
Returns nil and an error message on error.
3434
3535
tokenizeFile()
36-
tokens, error = tokenizeFile( path )
36+
tokens, error = parser.tokenizeFile( path )
3737
Convert the contents of a file into tokens. Uses io.open().
3838
Returns nil and an error message on error.
3939
4040
newTokenStream()
41-
tokens = newTokenStream( )
41+
tokens = parser.newTokenStream( )
4242
Create a new token stream table. (See more info below.)
4343
4444
insertToken()
45-
insertToken( tokens, [ index=tokens.n+1, ] tokenType, tokenValue )
45+
parser.insertToken( tokens, [ index=tokens.n+1, ] tokenType, tokenValue )
4646
Insert a new token. (Search for 'TokenInsertion' for more info.)
4747
4848
removeToken()
49-
removeToken( tokens [, index=1 ] )
49+
parser.removeToken( tokens [, index=1 ] )
5050
Remove a token.
5151
5252
parse()
53-
astNode, error = parse( tokens )
54-
astNode, error = parse( luaString, pathForErrors )
55-
astNode, error = parse( path )
53+
astNode, error = parser.parse( tokens )
54+
astNode, error = parser.parse( luaString, pathForErrors )
55+
astNode, error = parser.parse( path )
5656
Convert tokens or Lua code into an abstract syntax tree.
5757
Returns nil and an error message on error.
5858
5959
newNode()
60-
astNode = newNode( nodeType, arguments... )
60+
astNode = parser.newNode( nodeType, arguments... )
6161
Create a new AST node. (Search for 'NodeCreation' for more info.)
6262
6363
traverseTree()
64-
didBreak = traverseTree( astNode, callback [, topNodeParent=nil, topNodeContainer=nil, topNodeKey=nil ] )
64+
didBreak = parser.traverseTree( astNode, callback [, topNodeParent=nil, topNodeContainer=nil, topNodeKey=nil ] )
6565
action = callback( astNode, parent, container, key )
6666
action = "stop"|"ignorechildren"|nil -- Returning nil (or nothing) means continue traversal.
6767
Call a function on all nodes in an AST, going from astNode out to the leaf nodes.
6868
container[key] is the position of the current node in the tree and can be used to replace the node.
6969
7070
updateReferences()
71+
parser.updateReferences( astNode )
7172
Update references between nodes in the tree.
7273
This function sets 'parent', 'container' and 'key' for all nodes and 'declaration' for identifiers.
7374
7475
toLua()
75-
lua = toLua( astNode [, prettyOuput=false ] )
76+
lua = parser.toLua( astNode [, prettyOuput=false ] )
7677
Convert an AST to Lua. Returns nil on error.
7778
7879
printTokens()
79-
printTokens( tokens )
80+
parser.printTokens( tokens )
8081
Print the contents of a token stream to stdout.
8182
8283
printNode()
83-
printNode( astNode )
84+
parser.printNode( astNode )
8485
Print information about an AST node to stdout.
8586
8687
printTree()
87-
printTree( astNode )
88+
parser.printTree( astNode )
8889
Print the structure of a whole AST to stdout.
8990
9091

0 commit comments

Comments
 (0)