|
28 | 28 | -------------------------------- |
29 | 29 |
|
30 | 30 | tokenizeString() |
31 | | - tokens, error = tokenizeString( luaString [, pathForErrors="?" ] ) |
| 31 | + tokens, error = parser.tokenizeString( luaString [, pathForErrors="?" ] ) |
32 | 32 | Convert a Lua string into tokens. |
33 | 33 | Returns nil and an error message on error. |
34 | 34 |
|
35 | 35 | tokenizeFile() |
36 | | - tokens, error = tokenizeFile( path ) |
| 36 | + tokens, error = parser.tokenizeFile( path ) |
37 | 37 | Convert the contents of a file into tokens. Uses io.open(). |
38 | 38 | Returns nil and an error message on error. |
39 | 39 |
|
40 | 40 | newTokenStream() |
41 | | - tokens = newTokenStream( ) |
| 41 | + tokens = parser.newTokenStream( ) |
42 | 42 | Create a new token stream table. (See more info below.) |
43 | 43 |
|
44 | 44 | insertToken() |
45 | | - insertToken( tokens, [ index=tokens.n+1, ] tokenType, tokenValue ) |
| 45 | + parser.insertToken( tokens, [ index=tokens.n+1, ] tokenType, tokenValue ) |
46 | 46 | Insert a new token. (Search for 'TokenInsertion' for more info.) |
47 | 47 |
|
48 | 48 | removeToken() |
49 | | - removeToken( tokens [, index=1 ] ) |
| 49 | + parser.removeToken( tokens [, index=1 ] ) |
50 | 50 | Remove a token. |
51 | 51 |
|
52 | 52 | 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 ) |
56 | 56 | Convert tokens or Lua code into an abstract syntax tree. |
57 | 57 | Returns nil and an error message on error. |
58 | 58 |
|
59 | 59 | newNode() |
60 | | - astNode = newNode( nodeType, arguments... ) |
| 60 | + astNode = parser.newNode( nodeType, arguments... ) |
61 | 61 | Create a new AST node. (Search for 'NodeCreation' for more info.) |
62 | 62 |
|
63 | 63 | traverseTree() |
64 | | - didBreak = traverseTree( astNode, callback [, topNodeParent=nil, topNodeContainer=nil, topNodeKey=nil ] ) |
| 64 | + didBreak = parser.traverseTree( astNode, callback [, topNodeParent=nil, topNodeContainer=nil, topNodeKey=nil ] ) |
65 | 65 | action = callback( astNode, parent, container, key ) |
66 | 66 | action = "stop"|"ignorechildren"|nil -- Returning nil (or nothing) means continue traversal. |
67 | 67 | Call a function on all nodes in an AST, going from astNode out to the leaf nodes. |
68 | 68 | container[key] is the position of the current node in the tree and can be used to replace the node. |
69 | 69 |
|
70 | 70 | updateReferences() |
| 71 | + parser.updateReferences( astNode ) |
71 | 72 | Update references between nodes in the tree. |
72 | 73 | This function sets 'parent', 'container' and 'key' for all nodes and 'declaration' for identifiers. |
73 | 74 |
|
74 | 75 | toLua() |
75 | | - lua = toLua( astNode [, prettyOuput=false ] ) |
| 76 | + lua = parser.toLua( astNode [, prettyOuput=false ] ) |
76 | 77 | Convert an AST to Lua. Returns nil on error. |
77 | 78 |
|
78 | 79 | printTokens() |
79 | | - printTokens( tokens ) |
| 80 | + parser.printTokens( tokens ) |
80 | 81 | Print the contents of a token stream to stdout. |
81 | 82 |
|
82 | 83 | printNode() |
83 | | - printNode( astNode ) |
| 84 | + parser.printNode( astNode ) |
84 | 85 | Print information about an AST node to stdout. |
85 | 86 |
|
86 | 87 | printTree() |
87 | | - printTree( astNode ) |
| 88 | + parser.printTree( astNode ) |
88 | 89 | Print the structure of a whole AST to stdout. |
89 | 90 |
|
90 | 91 |
|
|
0 commit comments