Skip to content

Instantly share code, notes, and snippets.

@MattDiesel
Created June 12, 2013 22:08
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MattDiesel/5769560 to your computer and use it in GitHub Desktop.
Save MattDiesel/5769560 to your computer and use it in GitHub Desktop.
AutoIt parser written in AutoIt.
#cs
Syntax Tree Usage:
The syntax tree is a flat array of "branches". The branches can point to each other by referencing
the child branches index. In a simplistic way, the following tree:
1
/ \
2 3
/ \
4 5
Results in an array with the following columns:
Index | Left | Right
1 | 2 | 3
2 | 0 | 0
3 | 4 | 5
4 | 0 | 0
5 | 0 | 0
Reconstructing the tree from the table is usually done recursively, passing the tree and the index.
Test(Tree, 1, 1)
Func Test(Tree, Index, Depth)
Print Index
Test(Tree, Tree[Index].Left, Depth + 1)
Test(Tree, Tree[Index].Right, Depth + 1)
EndFunc
Gives the output:
> 1 2 3 4 5
To avoid the need for nested arrays, the syntax trees here will allow comma seperated lists of
indexes. So the new tree:
1
/ \
2 3 --------- 4 --------- 5
/ \ / \
6 7 8 9
Produces the table:
Index | Left | Right
1 | 2 | 3,4,5
2 | 0 | 0
3 | 6 | 7
4 | 0 | 0
5 | 8 | 9
6 | 0 | 0
7 | 0 | 0
8 | 0 | 0
9 | 0 | 0
#ce
#include <Array.au3>
#include "AuLex.au3"
; Branch Types
Global Enum $AP_BR_FILE = 0, _ ; Name|Body
$AP_BR_PREPROC, _ ; Line
$AP_BR_DECLLIST, _ ; 0|Flags|Declarations
$AP_BR_DECL, _ ; Name|Flags|Value
$AP_BR_ARRAYDECL, _ ; Lookup|Flags|Literal
$AP_BR_ASSIGN, _ ; Operator|LEft|Right
$AP_BR_FUNCDEF, _ ; Name|Parameters|Body
$AP_BR_IF, _ ; 0|Condition|Body
$AP_BR_WHILE, _ ; 0|Condition|Body
$AP_BR_DO, _ ; 0|Condition|Body
$AP_BR_FOR, _ ; Variable|Start,End,StepOp,Step|Body
$AP_BR_FORIN, _; Variable|Range|Body
$AP_BR_SELECT, _ ; 0|Cases
$AP_BR_SWITCH, _ ; Condition|Cases
$AP_BR_CASE, _ ; [Else]|Condition|Body
$AP_BR_STMT, _ ; Name|Expression
$AP_BR_REDIM, _ ; Lookup|0|Literal
$AP_BR_OP, _ ; Name|Left|Right
$AP_BR_GROUP, _ ; 0|Expr
$AP_BR_LOOKUP, _ ; 0|Variable|Indexes
$AP_BR_FUNCCALL, _ ; Name|Arguments
$AP_BR_NUMBER, _ ; Value
$AP_BR_STR, _ ; Value
$AP_BR_ARRAY, _ ; 0|Values
$AP_BR_VARIABLE, _ ; Name
$AP_BR_MACRO, _ ; Name
$_AP_BR_COUNT
; Branch name strings
Global Const $_AP_BR_NAMES[$_AP_BR_COUNT] = [ _
"File", _
"Preprocessor Line", _
"Variable Declarations", _
"Variable Declaration", _
"Array Declaration", _
"Assignment", _
"Function Definition", _
"IF...THEN test", _
"WHILE...WEND loop", _
"DO...UNTIL loop", _
"FOR...TO...NEXT loop", _
"FOR...IN...NEXT loop", _
"SELECT statement", _
"SWITCH statement", _
"CASE statement", _
"Statement", _
"ReDim", _
"Operator", _
"Group ()", _
"Array Lookup", _
"Function Call", _
"Number", _
"String", _
"Array Literal", _
"Variable", _
"Macro"]
; Syntax tree index
Global Enum $AP_STI_BRTYPE = 0, _
$AP_STI_VALUE, _
$AP_STI_LEFT, _
$AP_STI_RIGHT, _
$AP_STI_TOK_ABS, _
$AP_STI_TOK_LINE, _
$AP_STI_TOK_COL, _
$_AP_STI_COUNT
Global Enum _
$AP_VARF_LOCAL = 1, _
$AP_VARF_GLOBAL = 2, _
$AP_VARF_DIM = 4, _
$AP_VARF_STATIC = 8, _
$AP_VARF_CONST = 16, _
$AP_VARF_BYREF = 32
Global Enum _
$AP_OPPREC_NOT = 100, _
$AP_OPPREC_EXP = 90, _
$AP_OPPREC_MUL = 80, _
$AP_OPPREC_ADD = 70, _
$AP_OPPREC_CAT = 60, _
$AP_OPPREC_CMP = 50, _
$AP_OPPREC_AND = 40
Local $l = _AuLex_StartLex("Test.au3", $AL_FLAG_AUTOLINECONT)
Local $a = _AuParse_Parse($l)
MsgBox(0, $a, @error)
For $i = 1 To $a[0][0]
$a[$i][0] = $_AP_BR_NAMES[$a[$i][0]]
Next
_ArrayDisplay($a)
Func _AuParse_Parse(ByRef $lexer)
Local $aSt[100][$_AP_STI_COUNT]
$aSt[0][0] = 0
Local $iSt
Local $tk[2]
__AuParse_GetTok($lexer, $tk)
$iSt = __AuParse_AddStRow($aSt, $AP_BR_FILE, $lexer[$AL_LEXI_FILENAME])
Local $i
While $tk[0] <> $AL_TOK_EOF
$i = __AuParse_ParseLine($lexer, $aSt, $tk, True)
If $i = 0 Then
; Error: Error parsing line
Return SetError(@error, 0, 0)
ElseIf $i = -1 Then
ExitLoop
EndIf
$aSt[$iSt][$AP_STI_LEFT] &= $i & ","
WEnd
$aSt[$iSt][$AP_STI_LEFT] = StringTrimRight($aSt[$iSt][$AP_STI_LEFT], 1)
Return $aSt
EndFunc ;==>_AuParse_Parse
Func __AuParse_ParseExpr(ByRef $lexer, ByRef $aSt, ByRef $tk, $rbp = 0)
Local $tkPrev = $tk
__AuParse_GetTok($lexer, $tk)
Local $left = __AuParse_ParseExpr_Nud($lexer, $aSt, $tk, $tkPrev)
If $left = 0 Then
; Error: Unexpected token
Return SetError(@error, 0, 0)
EndIf
While __AuParse_ParseExpr_Lbp($tk) > $rbp
$tkPrev = $tk
__AuParse_GetTok($lexer, $tk)
$left = __AuParse_ParseExpr_Led($lexer, $aSt, $tk, $tkPrev, $left)
If $left = 0 Then
; Error: Error parsing expression
Return SetError(@error, 0, 0)
EndIf
WEnd
Return $left
EndFunc ;==>__AuParse_ParseExpr
Func __AuParse_ParseExpr_Nud(ByRef $lexer, ByRef $aSt, ByRef $tk, $tkPrev)
Local $iStRet, $i
Local $abs, $line, $col
Select
Case $tkPrev[0] = $AL_TOK_NUMBER
$iStRet = __AuParse_AddStRow($aSt, $AP_BR_NUMBER, $tkPrev[1])
Case $tkPrev[0] = $AL_TOK_STR
$iStRet = __AuParse_AddStRow($aSt, $AP_BR_STR, $tkPrev[1])
Case $tkPrev[0] = $AL_TOK_VARIABLE
If __AuParse_Accept($lexer, $tk, $AL_TOK_OPAR) Then
$iStRet = __AuParse_ParseFuncCall($lexer, $aSt, $tk, $tkPrev[1], $abs, $line, $col)
ElseIf __AuParse_Accept($lexer, $tk, $AL_TOK_OBRACK) Then
$i = __AuParse_AddStRow($aSt, $AP_BR_VARIABLE, $tkPrev[1])
$iStRet = __AuParse_ParseArrayLookup($lexer, $aSt, $tk, $i, $abs, $line, $col)
Else
$iStRet = __AuParse_AddStRow($aSt, $AP_BR_VARIABLE, $tkPrev[1])
EndIf
Case $tkPrev[0] = $AL_TOK_MACRO
$iStRet = __AuParse_AddStRow($aSt, $AP_BR_MACRO, $tkPrev[1])
Case $tkPrev[0] = $AL_TOK_OPAR
$i = __AuParse_ParseExpr($lexer, $aSt, $tk, 0)
If $i = 0 Then
; Error: Error parsing expression
Return SetError(@error, 0, 0)
EndIf
If Not __AuParse_Accept($lexer, $tk, $AL_TOK_EPAR) Then
; Error: Expected closing parentheses.
Return SetError(@ScriptLineNumber, 0, 0)
EndIf
$iStRet = __AuParse_AddStRow($aSt, $AP_BR_GROUP, "", $i)
Case $tkPrev[0] = $AL_TOK_KEYWORD And $tkPrev[1] = "Not"
$i = __AuParse_ParseExpr($lexer, $aSt, $tk, $AP_OPPREC_NOT)
If $i = 0 Then
; Error: Error parsing expression
Return SetError(@error, 0, 0)
EndIf
$iStRet = __AuParse_AddStRow($aSt, $AP_BR_OP, "Not", $i, 0)
Case $tkPrev[0] = $AL_TOK_OP And $tkPrev[1] = "+"
$i = __AuParse_ParseExpr($lexer, $aSt, $tk, $AP_OPPREC_NOT)
If $i = 0 Then
; Error: Error parsing expression
Return SetError(@error, 0, 0)
EndIf
$iStRet = __AuParse_AddStRow($aSt, $AP_BR_OP, "+", 0, $i)
Case $tkPrev[0] = $AL_TOK_OP And $tkPrev[1] = "-"
$i = __AuParse_ParseExpr($lexer, $aSt, $tk, $AP_OPPREC_NOT)
If $i = 0 Then
; Error: Error parsing expression
Return SetError(@error, 0, 0)
EndIf
$iStRet = __AuParse_AddStRow($aSt, $AP_BR_OP, "-", 0, $i)
Case $tkPrev[0] = $AL_TOK_FUNC Or $tkPrev[0] = $AL_TOK_WORD
If __AuParse_Accept($lexer, $tk, $AL_TOK_OPAR) Then
$iStRet = __AuParse_ParseFuncCall($lexer, $aSt, $tk, $tkPrev[1], $abs, $line, $col)
ElseIf __AuParse_Accept($lexer, $tk, $AL_TOK_OBRACK) Then
$i = __AuParse_AddStRow($aSt, $AP_BR_VARIABLE, $tkPrev[1])
$iStRet = __AuParse_ParseArrayLookup($lexer, $aSt, $tk, $i, $abs, $line, $col)
Else
$iStRet = __AuParse_AddStRow($aSt, $AP_BR_VARIABLE, $tkPrev[1])
EndIf
Case Else
_ArrayDisplay($aSt)
; Error: Unexpected token.
Return SetError(@ScriptLineNumber, 0, 0)
EndSelect
Return $iStRet
EndFunc ;==>__AuParse_ParseExpr_Nud
Func __AuParse_ParseExpr_Led(ByRef $lexer, ByRef $aSt, ByRef $tk, $tkPrev, $left)
Local $right, $iStRet, $s
If $tkPrev[0] <> $AL_TOK_OP Then
; Error: Expected operator.
Return SetError(@ScriptLineNumber, 0, 0)
EndIf
Switch $tkPrev[1]
Case "^", "*", "/", "+", "-", "&", "=", "==", "<", ">", "<=", ">=", "And", "Or"
$s = $tkPrev[1]
$right = __AuParse_ParseExpr($lexer, $aSt, $tk, __AuParse_ParseExpr_Lbp($tkPrev))
If $right = 0 Then
; Error: Error parsing expression
Return SetError(@error, 0, 0)
EndIf
$iStRet = __AuParse_AddStRow($aSt, $AP_BR_OP, $s, $left, $right)
Case Else
; Error: Operator not valid here
Return SetError(@ScriptLineNumber, 0, 0)
EndSwitch
Return $iStRet
EndFunc ;==>__AuParse_ParseExpr_Led
Func __AuParse_ParseExpr_Lbp($tk)
Local $iLbp = 0
If $tk[0] = $AL_TOK_OP Then
Switch $tk[1]
Case "Not"
$iLbp = $AP_OPPREC_NOT
Case "^"
$iLbp = $AP_OPPREC_EXP
Case "*", "/"
$iLbp = $AP_OPPREC_MUL
Case "+", "-"
$iLbp = $AP_OPPREC_ADD
Case "&"
$iLbp = $AP_OPPREC_CAT
Case "=", "==", "<", ">", "<=", ">="
$iLbp = $AP_OPPREC_CMP
Case "And", "Or"
$iLbp = $AP_OPPREC_AND
EndSwitch
EndIf
Return $iLbp
EndFunc ;==>__AuParse_ParseExpr_Lbp
Func __AuParse_ParseLine(ByRef $lexer, ByRef $aSt, ByRef $tk, $fTopLevel = False)
Local $iStRet, $i, $j
Local $abs, $line, $col
Local $sLastTokData, $s
; Ignore empty lines
While __AuParse_Accept($lexer, $tk, $AL_TOK_EOL)
WEnd
$sLastTokData = $tk[1]
Select
Case $fTopLevel And __AuParse_Accept($lexer, $tk, $AL_TOK_EOF)
Return -1
Case __AuParse_Accept($lexer, $tk, $AL_TOK_PREPROC)
$iStRet = __AuParse_AddStRow($aSt, $AP_BR_PREPROC, $tk[1], "", "", $lexer)
Case $fTopLevel And __AuParse_AcceptP($lexer, $tk, $AL_TOK_KEYWORD, "Func", $abs, $line, $col)
$iStRet = __AuParse_ParseFuncDecl($lexer, $aSt, $tk, $abs, $line, $col)
Case __AuParse_AcceptP($lexer, $tk, $AL_TOK_KEYWORD, "If", $abs, $line, $col)
$iStRet = __AuParse_ParseIf($lexer, $aSt, $tk, $abs, $line, $col)
Case __AuParse_AcceptP($lexer, $tk, $AL_TOK_KEYWORD, "Do", $abs, $line, $col)
$iStRet = __AuParse_ParseDo($lexer, $aSt, $tk, $abs, $line, $col)
Case __AuParse_AcceptP($lexer, $tk, $AL_TOK_KEYWORD, "While", $abs, $line, $col)
$iStRet = __AuParse_ParseWhile($lexer, $aSt, $tk, $abs, $line, $col)
Case __AuParse_AcceptP($lexer, $tk, $AL_TOK_KEYWORD, "For", $abs, $line, $col)
$iStRet = __AuParse_ParseFor($lexer, $aSt, $tk, $abs, $line, $col)
Case __AuParse_AcceptP($lexer, $tk, $AL_TOK_KEYWORD, "Select", $abs, $line, $col)
$iStRet = __AuParse_ParseSelect($lexer, $aSt, $tk, $abs, $line, $col)
Case __AuParse_AcceptP($lexer, $tk, $AL_TOK_KEYWORD, "Switch", $abs, $line, $col)
$iStRet = __AuParse_ParseSwitch($lexer, $aSt, $tk, $abs, $line, $col)
Case __AuParse_AcceptP($lexer, $tk, $AL_TOK_KEYWORD, "Local", $abs, $line, $col)
$i = $AP_VARF_LOCAL
If __AuParse_Accept($lexer, $tk, $AL_TOK_KEYWORD, "Enum") Then
$i = BitOR($i, $AP_VARF_CONST)
$iStRet = __AuParse_ParseEnumDecls($lexer, $aSt, $tk, $i, $abs, $line, $col)
Else
If __AuParse_Accept($lexer, $tk, $AL_TOK_KEYWORD, "Const") Then
If __AuParse_Accept($lexer, $tk, $AL_TOK_KEYWORD, "Static") Then
$i = BitOR($i, $AP_VARF_CONST, $AP_VARF_STATIC)
Else
$i = BitOR($i, $AP_VARF_CONST)
EndIf
ElseIf __AuParse_Accept($lexer, $tk, $AL_TOK_KEYWORD, "Static") Then
If __AuParse_Accept($lexer, $tk, $AL_TOK_KEYWORD, "Const") Then
$i = BitOR($i, $AP_VARF_STATIC, $AP_VARF_CONST)
Else
$i = BitOR($i, $AP_VARF_STATIC)
EndIf
EndIf
$iStRet = __AuParse_ParseDecls($lexer, $aSt, $tk, $i, $abs, $line, $col)
EndIf
Case __AuParse_AcceptP($lexer, $tk, $AL_TOK_KEYWORD, "Global", $abs, $line, $col)
$i = $AP_VARF_GLOBAL
If __AuParse_Accept($lexer, $tk, $AL_TOK_KEYWORD, "Enum") Then
$i = BitOR($i, $AP_VARF_CONST)
$iStRet = __AuParse_ParseEnumDecls($lexer, $aSt, $tk, $i, $abs, $line, $col)
Else
If __AuParse_Accept($lexer, $tk, $AL_TOK_KEYWORD, "Const") Then
$i = BitOR($i, $AP_VARF_CONST)
EndIf
$iStRet = __AuParse_ParseDecls($lexer, $aSt, $tk, $i, $abs, $line, $col)
EndIf
Case __AuParse_AcceptP($lexer, $tk, $AL_TOK_KEYWORD, "Dim", $abs, $line, $col)
$i = $AP_VARF_DIM
If __AuParse_Accept($lexer, $tk, $AL_TOK_KEYWORD, "Enum") Then
$i = BitOR($i, $AP_VARF_CONST)
$iStRet = __AuParse_ParseEnumDecls($lexer, $aSt, $tk, $i, $abs, $line, $col)
Else
If __AuParse_Accept($lexer, $tk, $AL_TOK_KEYWORD, "Const") Then
$i = BitOR($i, $AP_VARF_CONST)
EndIf
$iStRet = __AuParse_ParseDecls($lexer, $aSt, $tk, $i, $abs, $line, $col)
EndIf
Case __AuParse_AcceptP($lexer, $tk, $AL_TOK_KEYWORD, "Enum", $abs, $line, $col)
$i = BitOR($AP_VARF_DIM, $AP_VARF_CONST)
$iStRet = __AuParse_ParseEnumDecls($lexer, $aSt, $tk, $i, $abs, $line, $col)
Case __AuParse_AcceptP($lexer, $tk, $AL_TOK_KEYWORD, "Const", $abs, $line, $col)
$iStRet = __AuParse_ParseDecls($lexer, $aSt, $tk, $AP_VARF_DIM, $abs, $line, $col)
Case __AuParse_AcceptP($lexer, $tk, $AL_TOK_KEYWORD, "Static", $abs, $line, $col)
$i = $AP_VARF_STATIC
If __AuParse_Accept($lexer, $tk, $AL_TOK_KEYWORD, "Global") Then
$i = BitOR($i, $AP_VARF_GLOBAL)
ElseIf __AuParse_Accept($lexer, $tk, $AL_TOK_KEYWORD, "Local") Then
$i = BitOR($i, $AP_VARF_LOCAL)
EndIf
$iStRet = __AuParse_ParseDecls($lexer, $aSt, $tk, $i, $abs, $line, $col)
Case __AuParse_AcceptP($lexer, $tk, $AL_TOK_VARIABLE, Default, $abs, $line, $col)
$s = $tk[1]
If __AuParse_Accept($lexer, $tk, $AL_TOK_OBRACK) Then ; Array Assignment
$i = __AuParse_AddStRow($aSt, $AP_BR_VARIABLE, $sLastTokData, "", "", $abs, $line, $col)
$i = __AuParse_ParseArrayLookup($lexer, $aSt, $tk, $i)
If $i = 0 Then
; Error: Error parsing array lookup
Return SetError(@error, 0, 0)
EndIf
$s = $tk[1]
If Not __AuParse_Accept($lexer, $tk, $AL_TOK_ASSIGN) _
And Not __AuParse_Accept($lexer, $tk, $AL_TOK_OP, "=") Then
; Error: Expected assignment operator
Return SetError(@ScriptLineNumber, 0, 0)
EndIf
$j = __AuParse_ParseExpr($lexer, $aSt, $tk)
If $j = 0 Then
; Error: Error parsing expression
Return SetError(@error, 0, 0)
EndIf
$iStRet = __AuParse_AddStRow($aSt, $AP_BR_ASSIGN, $s, $i, $j)
If Not __AuParse_Accept($lexer, $tk, $AL_TOK_EOL) _
And Not __AuParse_Accept($lexer, $tk, $AL_TOK_EOF) Then
; Error: Extra characters on line
Return SetError(@ScriptLineNumber, 0, 0)
EndIf
ElseIf __AuParse_Accept($lexer, $tk, $AL_TOK_OPAR) Then ; Function call
$iStRet = __AuParse_ParseFuncCall($lexer, $aSt, $tk, $sLastTokData, $abs, $line, $col)
If Not __AuParse_Accept($lexer, $tk, $AL_TOK_EOL) _
And Not __AuParse_Accept($lexer, $tk, $AL_TOK_EOF) Then
; Error: Extra characters on line
Return SetError(@ScriptLineNumber, 0, 0)
EndIf
ElseIf __AuParse_Accept($lexer, $tk, $AL_TOK_ASSIGN) _
Or __AuParse_Accept($lexer, $tk, $AL_TOK_OP, "=") Then ; Assignment
$i = __AuParse_AddStRow($aSt, $AP_BR_VARIABLE, $sLastTokData)
$j = __AuParse_ParseExpr($lexer, $aSt, $tk)
If $j = 0 Then
; Error: Error parsing expression
Return SetError(@error, 0, 0)
EndIf
If Not __AuParse_Accept($lexer, $tk, $AL_TOK_EOL) Then
; Error: Extra characters on line
Return SetError(@ScriptLineNumber, 0, 0)
EndIf
$iStRet = __AuParse_AddStRow($aSt, $AP_BR_ASSIGN, $s, $i, $j)
Else
; Error: Expected statement
Return SetError(@ScriptLineNumber, 0, 0)
EndIf
; Object lookup? Todo.
Case __AuParse_Accept($lexer, $tk, $AL_TOK_WORD)
If __AuParse_Accept($lexer, $tk, $AL_TOK_OBRACK) Then ; Array Lookup
; Todo
ElseIf __AuParse_Accept($lexer, $tk, $AL_TOK_OPAR) Then ; Function call
$iStRet = __AuParse_ParseFuncCall($lexer, $aSt, $tk, $sLastTokData, $abs, $line, $col)
If Not __AuParse_Accept($lexer, $tk, $AL_TOK_EOL) _
And Not __AuParse_Accept($lexer, $tk, $AL_TOK_EOF) Then
; Error: Extra characters on line
Return SetError(@ScriptLineNumber, 0, 0)
EndIf
ElseIf __AuParse_Accept($lexer, $tk, $AL_TOK_ASSIGN) Then ; Assignment
$i = __AuParse_AddStRow($aSt, $AP_BR_VARIABLE, $sLastTokData)
$j = __AuParse_ParseExpr($lexer, $aSt, $tk)
If $j = 0 Then
; Error: Error parsing expression
Return SetError(@error, 0, 0)
EndIf
If Not __AuParse_Accept($lexer, $tk, $AL_TOK_EOL) Then
; Error: Extra characters on line
Return SetError(@ScriptLineNumber, 0, 0)
EndIf
$iStRet = __AuParse_AddStRow($aSt, $AP_BR_ASSIGN, $s, $i, $j)
Else
; Error: Expected statement
Return SetError(@ScriptLineNumber, 0, 0)
EndIf
Case __AuParse_Accept($lexer, $tk, $AL_TOK_FUNC)
If __AuParse_Accept($lexer, $tk, $AL_TOK_OPAR) Then ; Function call
$iStRet = __AuParse_ParseFuncCall($lexer, $aSt, $tk, $sLastTokData, $abs, $line, $col)
If Not __AuParse_Accept($lexer, $tk, $AL_TOK_EOL) _
And Not __AuParse_Accept($lexer, $tk, $AL_TOK_EOF) Then
; Error: Extra characters on line
Return SetError(@ScriptLineNumber, 0, 0)
EndIf
Else
; Error: Expected function call
Return SetError(@ScriptLineNumber, 0, 0)
EndIf
Case Else
_ArrayDisplay($aSt)
; Error: Unexpected token.
Return SetError(@ScriptLineNumber, 0, 0)
EndSelect
Return SetError(@error, 0, $iStRet)
EndFunc ;==>__AuParse_ParseLine
Func __AuParse_ParseIf(ByRef $lexer, ByRef $aSt, ByRef $tk, $abs = 0, $line = 0, $col = 0)
Local $iCondition, $sBody, $i
$iCondition = __AuParse_ParseExpr($lexer, $aSt, $tk)
If $iCondition = 0 Then
; Error: Error parsing expression
Return SetError(@error, 0, 0)
EndIf
If Not __AuParse_Accept($lexer, $tk, $AL_TOK_KEYWORD, "Then") Then
; Error: If statement has no matching Then
Return SetError(@ScriptLineNumber, 0, 0)
EndIf
If __AuParse_Accept($lexer, $tk, $AL_TOK_EOL) Then
; Multiline IF
While Not __AuParse_Accept($lexer, $tk, $AL_TOK_KEYWORD, "EndIf")
$i = __AuParse_ParseLine($lexer, $aSt, $tk)
If $i = 0 Then
; Error: Error parsing line
Return SetError(@error, 0, 0)
EndIf
$sBody &= $i & ","
WEnd
$sBody = StringTrimRight($sBody, 1)
Else
$sBody = __AuParse_ParseLine($lexer, $aSt, $tk)
If $sBody = 0 Then
; Error: Error parsing line
Return SetError(@error, 0, 0)
EndIf
EndIf
If Not __AuParse_Accept($lexer, $tk, $AL_TOK_EOL) _
And Not __AuParse_Accept($lexer, $tk, $AL_TOK_EOF) Then
; Error: Extra characters on line
Return SetError(@ScriptLineNumber, 0, 0)
EndIf
Return __AuParse_AddStRow($aSt, $AP_BR_IF, "", $iCondition, $sBody, $abs, $line, $col)
EndFunc ;==>__AuParse_ParseIf
Func __AuParse_ParseWhile(ByRef $lexer, ByRef $aSt, ByRef $tk, $abs = 0, $line = 0, $col = 0)
Local $iCondition, $sBody, $i
$iCondition = __AuParse_ParseExpr($lexer, $aSt, $tk)
If $iCondition = 0 Then
; Error: Error parsing expression
Return SetError(@error, 0, 0)
EndIf
If Not __AuParse_Accept($lexer, $tk, $AL_TOK_EOL) Then
; Error: Extra characters on line
Return SetError(@ScriptLineNumber, 0, 0)
EndIf
While Not __AuParse_Accept($lexer, $tk, $AL_TOK_KEYWORD, "WEnd")
$i = __AuParse_ParseLine($lexer, $aSt, $tk)
If $i = 0 Then
; Error: Error parsing line
Return SetError(@error, 0, 0)
EndIf
$sBody &= $i & ","
WEnd
$sBody = StringTrimRight($sBody, 1)
If Not __AuParse_Accept($lexer, $tk, $AL_TOK_EOL) _
And Not __AuParse_Accept($lexer, $tk, $AL_TOK_EOF) Then
; Error: Extra characters on line
Return SetError(@ScriptLineNumber, 0, 0)
EndIf
Return __AuParse_AddStRow($aSt, $AP_BR_WHILE, "", $iCondition, $sBody, $abs, $line, $col)
EndFunc ;==>__AuParse_ParseWhile
Func __AuParse_ParseFor(ByRef $lexer, ByRef $aSt, ByRef $tk, $abs = 0, $line = 0, $col = 0)
; TODO
EndFunc ;==>__AuParse_ParseFor
Func __AuParse_ParseDo(ByRef $lexer, ByRef $aSt, ByRef $tk, $abs = 0, $line = 0, $col = 0)
Local $iCondition, $sBody, $i
If Not __AuParse_Accept($lexer, $tk, $AL_TOK_EOL) Then
; Error: Extra characters on line
Return SetError(@ScriptLineNumber, 0, 0)
EndIf
While Not __AuParse_Accept($lexer, $tk, $AL_TOK_KEYWORD, "Until")
$i = __AuParse_ParseLine($lexer, $aSt, $tk)
If $i = 0 Then
; Error: Error parsing line
Return SetError(@error, 0, 0)
EndIf
$sBody &= $i & ","
WEnd
$sBody = StringTrimRight($sBody, 1)
$iCondition = __AuParse_ParseExpr($lexer, $aSt, $tk)
If $iCondition = 0 Then
; Error: Error parsing expression
Return SetError(@error, 0, 0)
EndIf
If Not __AuParse_Accept($lexer, $tk, $AL_TOK_EOL) Then
; Error: Extra characters on line
Return SetError(@ScriptLineNumber, 0, 0)
EndIf
Return __AuParse_AddStRow($aSt, $AP_BR_DO, "", $iCondition, $sBody, $abs, $line, $col)
EndFunc ;==>__AuParse_ParseDo
Func __AuParse_ParseSelect(ByRef $lexer, ByRef $aSt, ByRef $tk, $abs = 0, $line = 0, $col = 0)
Local $sCases = "", $i = 0, $j, $sBody
If Not __AuParse_Accept($lexer, $tk, $AL_TOK_EOL) Then
; Error: Extra characters on line
Return SetError(@ScriptLineNumber, 0, 0)
EndIf
While Not __AuParse_Accept($lexer, $tk, $AL_TOK_KEYWORD, "EndSelect")
If __AuParse_Accept($lexer, $tk, $AL_TOK_KEYWORD, "Case") Then
If $i <> 0 Then
$sBody = StringTrimRight($sBody, 1)
If $i = "Else" Then
$sCases &= __AuParse_AddStRow($aSt, $AP_BR_CASE, $i, "", $sBody) & ","
Else
$sCases &= __AuParse_AddStRow($aSt, $AP_BR_CASE, "", $i, $sBody) & ","
EndIf
EndIf
If __AuParse_Accept($lexer, $tk, $AL_TOK_KEYWORD, "Else") Then
$i = -1
Else
$i = __AuParse_ParseExpr($lexer, $aSt, $tk)
If $i = 0 Then
; Error: Error parsing expression
Return SetError(@error, 0, 0)
EndIf
EndIf
If Not __AuParse_Accept($lexer, $tk, $AL_TOK_EOL) Then
; Error: Extra characters on line
Return SetError(@ScriptLineNumber, 0, 0)
EndIf
$sBody = ""
Else
$j = __AuParse_ParseLine($lexer, $aSt, $tk)
If $j = 0 Then
; Error: Error parsing line
Return SetError(@error, 0, 0)
EndIf
$sBody &= $j & ","
EndIf
WEnd
If $i <> 0 Then
$sBody = StringTrimRight($sBody, 1)
If $i = -1 Then
$sCases &= __AuParse_AddStRow($aSt, $AP_BR_CASE, "Else", "", $sBody) & ","
Else
$sCases &= __AuParse_AddStRow($aSt, $AP_BR_CASE, "", $i, $sBody) & ","
EndIf
EndIf
$sCases = StringTrimRight($sCases, 1)
Return __AuParse_AddStRow($aSt, $AP_BR_SELECT, "", $sCases)
EndFunc ;==>__AuParse_ParseSelect
Func __AuParse_ParseSwitch(ByRef $lexer, ByRef $aSt, ByRef $tk, $abs = 0, $line = 0, $col = 0)
Local $iExpr, $sCases = "", $sBody = "", $i = 0, $j
$iExpr = __AuParse_ParseExpr($lexer, $aSt, $tk)
If $iExpr = 0 Then
; Error: Error parsing expression
Return SetError(@error, 0, 0)
EndIf
If Not __AuParse_Accept($lexer, $tk, $AL_TOK_EOL) Then
; Error: Extra characters on line
Return SetError(@ScriptLineNumber, 0, 0)
EndIf
While Not __AuParse_Accept($lexer, $tk, $AL_TOK_KEYWORD, "EndSwitch")
If __AuParse_Accept($lexer, $tk, $AL_TOK_KEYWORD, "Case") Then
If $i <> 0 Then
$sBody = StringTrimRight($sBody, 1)
If $i = "Else" Then
$sCases &= __AuParse_AddStRow($aSt, $AP_BR_CASE, $i, "", $sBody) & ","
Else
$sCases &= __AuParse_AddStRow($aSt, $AP_BR_CASE, "", $i, $sBody) & ","
EndIf
EndIf
If __AuParse_Accept($lexer, $tk, $AL_TOK_KEYWORD, "Else") Then
$i = -1
Else
$i = __AuParse_ParseExpr($lexer, $aSt, $tk)
If $i = 0 Then
; Error: Error parsing expression
Return SetError(@error, 0, 0)
EndIf
EndIf
If Not __AuParse_Accept($lexer, $tk, $AL_TOK_EOL) Then
; Error: Extra characters on line
Return SetError(@ScriptLineNumber, 0, 0)
EndIf
$sBody = ""
Else
$j = __AuParse_ParseLine($lexer, $aSt, $tk)
If $j = 0 Then
; Error: Error parsing line
Return SetError(@error, 0, 0)
EndIf
$sBody &= $j & ","
EndIf
WEnd
If $i <> 0 Then
$sBody = StringTrimRight($sBody, 1)
If $i = -1 Then
$sCases &= __AuParse_AddStRow($aSt, $AP_BR_CASE, "Else", "", $sBody) & ","
Else
$sCases &= __AuParse_AddStRow($aSt, $AP_BR_CASE, "", $i, $sBody) & ","
EndIf
EndIf
$sCases = StringTrimRight($sCases, 1)
Return __AuParse_AddStRow($aSt, $AP_BR_SWITCH, $iExpr, $sCases)
EndFunc ;==>__AuParse_ParseSwitch
Func __AuParse_ParseFuncCall(ByRef $lexer, ByRef $aSt, ByRef $tk, $sFuncName, $abs = 0, $line = 0, $col = 0)
Local $sParams, $i
If Not __AuParse_Accept($lexer, $tk, $AL_TOK_EPAR) Then
Do
$i = __AuParse_ParseExpr($lexer, $aSt, $tk)
If $i = 0 Then
; Error: Error parsing function argument expression
Return SetError(@error, 0, 0)
EndIf
$sParams &= $i & ","
Until Not __AuParse_Accept($lexer, $tk, $AL_TOK_COMMA)
$sParams = StringTrimRight($sParams, 1)
If Not __AuParse_Accept($lexer, $tk, $AL_TOK_EPAR) Then
; Error: Expected closing parenthesis.
Return SetError(@ScriptLineNumber, 0, 0)
EndIf
Else
$sParams = 0
EndIf
Return __AuParse_AddStRow($aSt, $AP_BR_FUNCCALL, $sFuncName, $sParams, "", $abs, $line, $col)
EndFunc ;==>__AuParse_ParseFuncCall
Func __AuParse_ParseParamDecl(ByRef $lexer, ByRef $aSt, ByRef $tk, $abs = 0, $line = 0, $col = 0)
Local $sVarName, $iFlags, $iDefault
$sVarName = $tk[1]
$iFlags = 0
$iDefault = 0
If __AuParse_Accept($lexer, $tk, $AL_TOK_KEYWORD, "ByRef") Then
$sVarName = $tk[1]
$iFlags = BitOR($iFlags, $AP_VARF_BYREF)
If __AuParse_Accept($lexer, $tk, $AL_TOK_KEYWORD, "Const") Then
$sVarName = $tk[1]
$iFlags = BitOR($iFlags, $AP_VARF_CONST)
EndIf
EndIf
If __AuParse_Accept($lexer, $tk, $AL_TOK_KEYWORD, "Const") Then
$sVarName = $tk[1]
$iFlags = BitOR($iFlags, $AP_VARF_CONST)
If __AuParse_Accept($lexer, $tk, $AL_TOK_KEYWORD, "Byref") Then
$sVarName = $tk[1]
$iFlags = BitOR($iFlags, $AP_VARF_BYREF)
EndIf
EndIf
If Not __AuParse_Accept($lexer, $tk, $AL_TOK_VARIABLE) Then
; Error: Expected variable name
Return SetError(@ScriptLineNumber, 0, 0)
EndIf
If __AuParse_Accept($lexer, $tk, $AL_TOK_OP, "=") Then
; Default value
$iDefault = __AuParse_ParseExpr($lexer, $aSt, $tk)
EndIf
Return __AuParse_AddStRow($aSt, $AP_BR_DECL, $sVarName, $iFlags, $iDefault, $abs, $line, $col)
EndFunc ;==>__AuParse_ParseParamDecl
Func __AuParse_ParseFuncDecl(ByRef $lexer, ByRef $aSt, ByRef $tk, $abs = 0, $line = 0, $col = 0)
Local $sFuncName = $tk[1], $sParams, $i, $sLines
If Not __AuParse_Accept($lexer, $tk, $AL_TOK_WORD) Then
; Error: Expected function name
Return SetError(@ScriptLineNumber, 0, 0)
EndIf
If Not __AuParse_Accept($lexer, $tk, $AL_TOK_OPAR) Then
; Error: Expected function parameter list
Return SetError(@ScriptLineNumber, 0, 0)
EndIf
$sParams = ""
Do
$i = __AuParse_ParseParamDecl($lexer, $aSt, $tk)
If $i = 0 Then
; Error: Error parsing parameter declaration
Return SetError(@error, 0, 0)
EndIf
$sParams &= $i & ","
Until Not __AuParse_Accept($lexer, $tk, $AL_TOK_COMMA)
$sParams = StringTrimRight($sParams, 1)
If Not __AuParse_Accept($lexer, $tk, $AL_TOK_EPAR) Then
; Error: Expected closing parenthesis
Return SetError(@ScriptLineNumber, 0, 0)
EndIf
If Not __AuParse_Accept($lexer, $tk, $AL_TOK_EOL) Then
; Error: Expected newline
Return SetError(@ScriptLineNumber, 0, 0)
EndIf
$sLines = ""
While Not __AuParse_Accept($lexer, $tk, $AL_TOK_KEYWORD, "EndFunc")
$i = __AuParse_ParseLine($lexer, $aSt, $tk)
If $i = 0 Then
; Error: Error parsing line
Return SetError(@error, 0, 0)
EndIf
$sLines &= $i & ","
WEnd
$sLines = StringTrimRight($sLines, 1)
Return __AuParse_AddStRow($aSt, $AP_BR_FUNCDEF, $sFuncName, $sParams, $sLines, $abs, $line, $col)
EndFunc ;==>__AuParse_ParseFuncDecl
Func __AuParse_ParseEnumDecls(ByRef $lexer, ByRef $aSt, ByRef $tk, $iFlags, $abs = 0, $line = 0, $col = 0)
Local $sVarName, $iValue, $dabs, $dline, $dcol, $j, $iIncrement = 0
Local $sDecls = ""
Do
$sVarName = $tk[1]
$dabs = $lexer[$AL_LEXI_LASTTOK_ABS]
$dline = $lexer[$AL_LEXI_LASTTOK_LINE]
$dcol = $lexer[$AL_LEXI_LASTTOK_COL]
If Not __AuParse_Accept($lexer, $tk, $AL_TOK_VARIABLE) _
And Not __AuParse_Accept($lexer, $tk, $AL_TOK_WORD) Then
; Error: Expected a variable name.
Return SetError(@ScriptLineNumber, 0, 0)
EndIf
If __AuParse_Accept($lexer, $tk, $AL_TOK_OP, "=") Then ; Definition
$iValue = __AuParse_ParseExpr($lexer, $aSt, $tk)
If $iValue = 0 Then
; Error: Error parsing expression
Return SetError(@error, 0, 0)
EndIf
$sDecls &= __AuParse_AddStRow($aSt, $AP_BR_DECL, $sVarName, $iFlags, $iValue, $dabs, $dline, $dcol) & ","
$iIncrement = 0
Else
$iIncrement += 1
$j = __AuParse_AddStRow($aSt, $AP_BR_NUMBER, $iIncrement)
$j = __AuParse_AddStRow($aSt, $AP_BR_OP, "+", $j, $iValue)
$sDecls &= __AuParse_AddStRow($aSt, $AP_BR_DECL, $sVarName, $iFlags, $j, $dabs, $dline, $dcol) & ","
EndIf
Until Not __AuParse_Accept($lexer, $tk, $AL_TOK_COMMA)
$sDecls = StringTrimRight($sDecls, 1)
If Not __AuParse_Accept($lexer, $tk, $AL_TOK_EOL) _
And Not __AuParse_Accept($lexer, $tk, $AL_TOK_EOF) Then
; Error: Expected end of line
Return SetError(@ScriptLineNumber, 0, 0)
EndIf
If Not StringInStr($sDecls, ",") Then
; Override position to start of full declaration
If $abs <> 0 Then
$aSt[$sDecls][$AP_STI_TOK_ABS] = $abs
$aSt[$sDecls][$AP_STI_TOK_LINE] = $line
$aSt[$sDecls][$AP_STI_TOK_COL] = $col
EndIf
Return $sDecls ; Single declaration
EndIf
Return __AuParse_AddStRow($aSt, $AP_BR_DECLLIST, "", $iFlags, $sDecls, $abs, $line, $col)
EndFunc ;==>__AuParse_ParseEnumDecls
Func __AuParse_ParseDecls(ByRef $lexer, ByRef $aSt, ByRef $tk, $iFlags, $abs = 0, $line = 0, $col = 0)
Local $sVarName, $iValue, $dabs, $dline, $dcol
Local $sDecls = ""
Do
$sVarName = $tk[1]
$dabs = $lexer[$AL_LEXI_LASTTOK_ABS]
$dline = $lexer[$AL_LEXI_LASTTOK_LINE]
$dcol = $lexer[$AL_LEXI_LASTTOK_COL]
If Not __AuParse_Accept($lexer, $tk, $AL_TOK_VARIABLE) _
And Not __AuParse_Accept($lexer, $tk, $AL_TOK_WORD) Then
; Error: Expected a variable name.
Return SetError(@ScriptLineNumber, 0, 0)
EndIf
If __AuParse_Accept($lexer, $tk, $AL_TOK_OBRACK) Then ; Array Decl
$sDecls &= __AuParse_ParseDeclArray($lexer, $aSt, $tk, $iFlags, $sVarName, $dabs, $dline, $dcol) & ","
ElseIf __AuParse_Accept($lexer, $tk, $AL_TOK_OP, "=") Then ; Definition
$iValue = __AuParse_ParseExpr($lexer, $aSt, $tk)
If $iValue = 0 Then
; Error: Error parsing expression
Return SetError(@error, 0, 0)
EndIf
$sDecls &= __AuParse_AddStRow($aSt, $AP_BR_DECL, $sVarName, $iFlags, $iValue, $dabs, $dline, $dcol) & ","
Else
$sDecls &= __AuParse_AddStRow($aSt, $AP_BR_DECL, $sVarName, $iFlags, 0, $dabs, $dline, $dcol) & ","
EndIf
Until Not __AuParse_Accept($lexer, $tk, $AL_TOK_COMMA)
$sDecls = StringTrimRight($sDecls, 1)
If Not __AuParse_Accept($lexer, $tk, $AL_TOK_EOL) _
And Not __AuParse_Accept($lexer, $tk, $AL_TOK_EOF) Then
; Error: Expected end of line
Return SetError(@ScriptLineNumber, 0, 0)
EndIf
If Not StringInStr($sDecls, ",") Then
; Override position to start of full declaration
If $abs <> 0 Then
$aSt[$sDecls][$AP_STI_TOK_ABS] = $abs
$aSt[$sDecls][$AP_STI_TOK_LINE] = $line
$aSt[$sDecls][$AP_STI_TOK_COL] = $col
EndIf
Return $sDecls ; Single declaration
EndIf
Return __AuParse_AddStRow($aSt, $AP_BR_DECLLIST, "", $iFlags, $sDecls, $abs, $line, $col)
EndFunc ;==>__AuParse_ParseDecls
; The first [ of the declaration has been accepted.
Func __AuParse_ParseDeclArray(ByRef $lexer, ByRef $aSt, ByRef $tk, $iFlags, $sVarName, $abs = 0, $line = 0, $col = 0)
Local $iVariable, $iLookup, $iLiteral, $labs, $lline, $lcol
$iVariable = __AuParse_AddStRow($aSt, $AP_BR_VARIABLE, $sVarName, "", "", $abs, $line, $col)
$iLookup = __AuParse_ParseArrayLookup($lexer, $aSt, $tk, $iVariable)
If $iLookup = 0 Then
; Error: Error parsing lookup
Return SetError(@error, 0, 0)
EndIf
If __AuParse_Accept($lexer, $tk, $AL_TOK_OP, "=") Then
; Array is being defined
If __AuParse_AcceptP($lexer, $tk, $AL_TOK_OBRACK, Default, $labs, $lline, $lcol) Then
$iLiteral = __AuParse_ParseArrayLiteral($lexer, $aSt, $tk, $labs, $lline, $lcol)
If $iLiteral = 0 Then
; Error: Error parsing array literal
Return SetError(@error, 0, 0)
EndIf
Else
; Error: Expected array literal
Return SetError(@ScriptLineNumber, 0, 0)
EndIf
Else
$iLiteral = 0
EndIf
Return __AuParse_AddStRow($aSt, $AP_BR_ARRAYDECL, $iLookup, $iFlags, $iLiteral, $abs, $line, $col)
EndFunc ;==>__AuParse_ParseDeclArray
; The first [ of the declaration has been accepted.
Func __AuParse_ParseArrayLookup(ByRef $lexer, ByRef $aSt, ByRef $tk, $iLeft, $abs = 0, $line = 0, $col = 0)
Local $sIndexes, $i
Do
$i = __AuParse_ParseExpr($lexer, $aSt, $tk)
If $i = 0 Then
; Error: Error parsing expression
Return SetError(@error, 0, 0)
EndIf
If Not __AuParse_Accept($lexer, $tk, $AL_TOK_EBRACK) Then
; Error: Expected closing bracket.
Return SetError(@ScriptLineNumber, 0, 0)
EndIf
$sIndexes &= $i & ","
Until Not __AuParse_Accept($lexer, $tk, $AL_TOK_OBRACK)
$sIndexes = StringTrimRight($sIndexes, 1)
Return __AuParse_AddStRow($aSt, $AP_BR_LOOKUP, "", $iLeft, $sIndexes, $abs, $line, $col)
EndFunc ;==>__AuParse_ParseArrayLookup
; The first [ of the declaration has been accepted.
Func __AuParse_ParseArrayLiteral(ByRef $lexer, ByRef $aSt, ByRef $tk, $abs = 0, $line = 0, $col = 0)
; TODO
EndFunc ;==>__AuParse_ParseArrayLiteral
Func __AuParse_GetTok(ByRef $lexer, ByRef $tk)
Do
$tk[1] = _AuLex_NextToken($lexer)
$tk[0] = @extended
Until $tk[0] <> $AL_TOK_COMMENT
EndFunc ;==>__AuParse_GetTok
Func __AuParse_Accept(ByRef $lexer, ByRef $tk, $iTokType = Default, $sTokData = Default)
If $iTokType <> Default And $tk[0] <> $iTokType Then Return False
If $sTokData <> Default And $tk[1] <> $sTokData Then Return False
__AuParse_GetTok($lexer, $tk)
Return True
EndFunc ;==>__AuParse_Accept
Func __AuParse_AcceptP(ByRef $lexer, ByRef $tk, $iTokType, $sTokData, ByRef $abs, ByRef $line, ByRef $col)
If $iTokType <> Default And $tk[0] <> $iTokType Then Return False
If $sTokData <> Default And $tk[1] <> $sTokData Then Return False
$abs = $lexer[$AL_LEXI_LASTTOK_ABS]
$line = $lexer[$AL_LEXI_LASTTOK_LINE]
$col = $lexer[$AL_LEXI_LASTTOK_COL]
__AuParse_GetTok($lexer, $tk)
Return True
EndFunc ;==>__AuParse_AcceptP
Func __AuParse_Expect(ByRef $lexer, ByRef $tk, $iTokType = Default, $sTokData = Default)
If Not __AuParse_Accept($lexer, $tk, $iTokType, $sTokData) Then
; Error: Unexpected token!
Return SetError(1, 0, False)
EndIf
Return True
EndFunc ;==>__AuParse_Expect
Func __AuParse_AddStRow(ByRef $aSt, $iType, $vValue, $brLeft = "", $brRight = "", $iAbs = 0, $iLine = 0, $iCol = 0)
If $aSt[0][0] >= UBound($aSt) - 1 Then
ReDim $aSt[$aSt[0][0] + 100][$_AP_STI_COUNT]
EndIf
$aSt[0][0] += 1
$aSt[$aSt[0][0]][$AP_STI_BRTYPE] = $iType
$aSt[$aSt[0][0]][$AP_STI_VALUE] = $vValue
$aSt[$aSt[0][0]][$AP_STI_LEFT] = $brLeft
$aSt[$aSt[0][0]][$AP_STI_RIGHT] = $brRight
$aSt[$aSt[0][0]][$AP_STI_TOK_ABS] = $iAbs
$aSt[$aSt[0][0]][$AP_STI_TOK_LINE] = $iLine
$aSt[$aSt[0][0]][$AP_STI_TOK_COL] = $iCol
If IsArray($iAbs) Then ; Pass a lexer for position
$aSt[$aSt[0][0]][$AP_STI_TOK_ABS] = $iAbs[$AL_LEXI_LASTTOK_ABS]
$aSt[$aSt[0][0]][$AP_STI_TOK_LINE] = $iAbs[$AL_LEXI_LASTTOK_LINE]
$aSt[$aSt[0][0]][$AP_STI_TOK_COL] = $iAbs[$AL_LEXI_LASTTOK_COL]
EndIf
Return $aSt[0][0]
EndFunc ;==>__AuParse_AddStRow
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment