mirror of https://github.com/Wilfred/difftastic/
parent
de601cbfc5
commit
97bab83730
@ -1 +0,0 @@
|
|||||||
../tree-sitter-pascal/queries/highlights.scm
|
|
||||||
@ -0,0 +1,347 @@
|
|||||||
|
;; MIT license: https://github.com/Isopod/tree-sitter-pascal/blob/78426d96bde7114af979e314283e45d087603428/queries/highlights.scm
|
||||||
|
|
||||||
|
; -- Keywords
|
||||||
|
[
|
||||||
|
(kProgram)
|
||||||
|
(kLibrary)
|
||||||
|
(kUnit)
|
||||||
|
(kUses)
|
||||||
|
|
||||||
|
(kBegin)
|
||||||
|
(kEnd)
|
||||||
|
(kAsm)
|
||||||
|
|
||||||
|
(kVar)
|
||||||
|
(kThreadvar)
|
||||||
|
(kConst)
|
||||||
|
(kResourcestring)
|
||||||
|
(kConstref)
|
||||||
|
(kOut)
|
||||||
|
(kType)
|
||||||
|
(kLabel)
|
||||||
|
(kExports)
|
||||||
|
|
||||||
|
(kAbsolute)
|
||||||
|
|
||||||
|
(kProperty)
|
||||||
|
(kRead)
|
||||||
|
(kWrite)
|
||||||
|
(kImplements)
|
||||||
|
(kDefault)
|
||||||
|
(kNodefault)
|
||||||
|
(kStored)
|
||||||
|
(kIndex)
|
||||||
|
(kDispId)
|
||||||
|
|
||||||
|
(kClass)
|
||||||
|
(kInterface)
|
||||||
|
(kDispInterface)
|
||||||
|
(kObject)
|
||||||
|
(kRecord)
|
||||||
|
(kObjcclass)
|
||||||
|
(kObjccategory)
|
||||||
|
(kObjcprotocol)
|
||||||
|
(kArray)
|
||||||
|
(kFile)
|
||||||
|
(kString)
|
||||||
|
(kSet)
|
||||||
|
(kOf)
|
||||||
|
(kHelper)
|
||||||
|
(kPacked)
|
||||||
|
|
||||||
|
(kGeneric)
|
||||||
|
(kSpecialize)
|
||||||
|
|
||||||
|
(kFunction)
|
||||||
|
(kProcedure)
|
||||||
|
(kConstructor)
|
||||||
|
(kDestructor)
|
||||||
|
(kOperator)
|
||||||
|
(kReference)
|
||||||
|
|
||||||
|
(kInterface)
|
||||||
|
(kImplementation)
|
||||||
|
(kInitialization)
|
||||||
|
(kFinalization)
|
||||||
|
|
||||||
|
(kPublished)
|
||||||
|
(kPublic)
|
||||||
|
(kProtected)
|
||||||
|
(kPrivate)
|
||||||
|
(kStrict)
|
||||||
|
(kRequired)
|
||||||
|
(kOptional)
|
||||||
|
|
||||||
|
(kForward)
|
||||||
|
|
||||||
|
(kStatic)
|
||||||
|
(kVirtual)
|
||||||
|
(kAbstract)
|
||||||
|
(kSealed)
|
||||||
|
(kDynamic)
|
||||||
|
(kOverride)
|
||||||
|
(kOverload)
|
||||||
|
(kReintroduce)
|
||||||
|
(kInherited)
|
||||||
|
(kInline)
|
||||||
|
|
||||||
|
(kStdcall)
|
||||||
|
(kCdecl)
|
||||||
|
(kCppdecl)
|
||||||
|
(kPascal)
|
||||||
|
(kRegister)
|
||||||
|
(kMwpascal)
|
||||||
|
(kExternal)
|
||||||
|
(kName)
|
||||||
|
(kMessage)
|
||||||
|
(kDeprecated)
|
||||||
|
(kExperimental)
|
||||||
|
(kPlatform)
|
||||||
|
(kUnimplemented)
|
||||||
|
(kCvar)
|
||||||
|
(kExport)
|
||||||
|
(kFar)
|
||||||
|
(kNear)
|
||||||
|
(kSafecall)
|
||||||
|
(kAssembler)
|
||||||
|
(kNostackframe)
|
||||||
|
(kInterrupt)
|
||||||
|
(kNoreturn)
|
||||||
|
(kIocheck)
|
||||||
|
(kLocal)
|
||||||
|
(kHardfloat)
|
||||||
|
(kSoftfloat)
|
||||||
|
(kMs_abi_default)
|
||||||
|
(kMs_abi_cdecl)
|
||||||
|
(kSaveregisters)
|
||||||
|
(kSysv_abi_default)
|
||||||
|
(kSysv_abi_cdecl)
|
||||||
|
(kVectorcall)
|
||||||
|
(kVarargs)
|
||||||
|
(kWinapi)
|
||||||
|
(kAlias)
|
||||||
|
(kDelayed)
|
||||||
|
|
||||||
|
(kFor)
|
||||||
|
(kTo)
|
||||||
|
(kDownto)
|
||||||
|
(kIf)
|
||||||
|
(kThen)
|
||||||
|
(kElse)
|
||||||
|
(kDo)
|
||||||
|
(kWhile)
|
||||||
|
(kRepeat)
|
||||||
|
(kUntil)
|
||||||
|
(kTry)
|
||||||
|
(kExcept)
|
||||||
|
(kFinally)
|
||||||
|
(kRaise)
|
||||||
|
(kOn)
|
||||||
|
(kCase)
|
||||||
|
(kWith)
|
||||||
|
(kGoto)
|
||||||
|
] @keyword
|
||||||
|
|
||||||
|
; -- Punctuation & operators
|
||||||
|
|
||||||
|
[
|
||||||
|
"("
|
||||||
|
")"
|
||||||
|
"["
|
||||||
|
"]"
|
||||||
|
] @punctuation.bracket
|
||||||
|
|
||||||
|
[
|
||||||
|
";"
|
||||||
|
","
|
||||||
|
":"
|
||||||
|
".."
|
||||||
|
(kEndDot)
|
||||||
|
] @punctuation.delimiter
|
||||||
|
|
||||||
|
[
|
||||||
|
(kDot)
|
||||||
|
(kAdd)
|
||||||
|
(kSub)
|
||||||
|
(kMul)
|
||||||
|
(kFdiv)
|
||||||
|
(kAssign)
|
||||||
|
(kAssignAdd)
|
||||||
|
(kAssignSub)
|
||||||
|
(kAssignMul)
|
||||||
|
(kAssignDiv)
|
||||||
|
(kEq)
|
||||||
|
(kLt)
|
||||||
|
(kLte)
|
||||||
|
(kGt)
|
||||||
|
(kGte)
|
||||||
|
(kNeq)
|
||||||
|
(kAt)
|
||||||
|
(kHat)
|
||||||
|
] @operator
|
||||||
|
|
||||||
|
; technically operators, but better to render as reserved words
|
||||||
|
[
|
||||||
|
(kOr)
|
||||||
|
(kXor)
|
||||||
|
(kDiv)
|
||||||
|
(kMod)
|
||||||
|
(kAnd)
|
||||||
|
(kShl)
|
||||||
|
(kShr)
|
||||||
|
(kNot)
|
||||||
|
(kIs)
|
||||||
|
(kAs)
|
||||||
|
(kIn)
|
||||||
|
] @keyword
|
||||||
|
|
||||||
|
; -- Builtin constants
|
||||||
|
|
||||||
|
[
|
||||||
|
(kTrue)
|
||||||
|
(kFalse)
|
||||||
|
] @constant;
|
||||||
|
|
||||||
|
; arguably a constant, but we highlight it as a keyword
|
||||||
|
[
|
||||||
|
(kNil)
|
||||||
|
] @keyword
|
||||||
|
|
||||||
|
; -- Literals
|
||||||
|
|
||||||
|
(literalNumber) @number
|
||||||
|
(literalString) @string
|
||||||
|
|
||||||
|
; -- Comments
|
||||||
|
(comment) @comment
|
||||||
|
(pp) @keyword
|
||||||
|
|
||||||
|
; -- Type declaration
|
||||||
|
|
||||||
|
(declType name: (identifier) @type)
|
||||||
|
(declType name: (genericTpl entity: (identifier) @type))
|
||||||
|
|
||||||
|
; -- Procedure & function declarations
|
||||||
|
|
||||||
|
; foobar
|
||||||
|
(declProc name: (identifier) @function)
|
||||||
|
; foobar<t>
|
||||||
|
(declProc name: (genericTpl entity: (identifier) @function))
|
||||||
|
; foo.bar
|
||||||
|
(declProc name: (genericDot rhs: (identifier) @function))
|
||||||
|
; foo.bar<t>
|
||||||
|
(declProc name: (genericDot rhs: (genericTpl entity: (identifier) @function)))
|
||||||
|
|
||||||
|
; Treat property declarations like functions
|
||||||
|
|
||||||
|
(declProp name: (identifier) @function)
|
||||||
|
|
||||||
|
; -- Function parameters
|
||||||
|
|
||||||
|
(declArg name: (identifier) @variable.parameter)
|
||||||
|
|
||||||
|
; -- Template parameters
|
||||||
|
|
||||||
|
(genericArg name: (identifier) @type.parameter)
|
||||||
|
(genericArg type: (typeref) @type)
|
||||||
|
|
||||||
|
(genericDot (identifier) @type)
|
||||||
|
(genericDot (genericTpl entity: (identifier) @type))
|
||||||
|
|
||||||
|
; -- Exception parameters
|
||||||
|
(exceptionHandler variable: (identifier) @variable.parameter)
|
||||||
|
|
||||||
|
; -- Type usage
|
||||||
|
|
||||||
|
(typeref) @type
|
||||||
|
|
||||||
|
; -- Constant usage
|
||||||
|
|
||||||
|
[
|
||||||
|
(caseLabel)
|
||||||
|
(label)
|
||||||
|
] @constant;
|
||||||
|
|
||||||
|
|
||||||
|
;;; ---------------------------------------------- ;;;
|
||||||
|
;;; EVERYTHING BELOW THIS IS OF QUESTIONABLE VALUE ;;;
|
||||||
|
;;; ---------------------------------------------- ;;;
|
||||||
|
|
||||||
|
; -- Break, Continue & Exit
|
||||||
|
; (Not ideal: ideally, there would be a way to check if these special
|
||||||
|
; identifiers are shadowed by a local variable)
|
||||||
|
(statement ((identifier) @keyword
|
||||||
|
(#match? @keyword "^[eE][xX][iI][tT]$")))
|
||||||
|
(statement (exprCall entity: ((identifier) @keyword
|
||||||
|
(#match? @keyword "^[eE][xX][iI][tT]$"))))
|
||||||
|
(statement ((identifier) @keyword
|
||||||
|
(#match? @keyword "^[bB][rR][eE][aA][kK]$")))
|
||||||
|
(statement ((identifier) @keyword
|
||||||
|
(#match? @keyword "^[cC][oO][nN][tT][iI][nN][uU][eE]$")))
|
||||||
|
|
||||||
|
; -- Procedure name in calls with parentheses
|
||||||
|
; (Pascal doesn't require parentheses for procedure calls, so this will not
|
||||||
|
; detect all calls)
|
||||||
|
|
||||||
|
; foobar
|
||||||
|
(exprCall entity: (identifier) @function)
|
||||||
|
; foobar<t>
|
||||||
|
(exprCall entity: (exprTpl entity: (identifier) @function))
|
||||||
|
; foo.bar
|
||||||
|
(exprCall entity: (exprDot rhs: (identifier) @function))
|
||||||
|
; foo.bar<t>
|
||||||
|
(exprCall entity: (exprDot rhs: (exprTpl entity: (identifier) @function)))
|
||||||
|
|
||||||
|
; -- Heuristic for procedure/function calls without parentheses
|
||||||
|
; (If a statement consists only of an identifier, assume it's a procedure)
|
||||||
|
; (This will still not match all procedure calls, and also may produce false
|
||||||
|
; positives in rare cases, but only for nonsensical code)
|
||||||
|
|
||||||
|
(statement (identifier) @function)
|
||||||
|
(statement (exprDot rhs: (identifier) @function))
|
||||||
|
(statement (exprTpl entity: (identifier) @function))
|
||||||
|
(statement (exprDot rhs: (exprTpl entity: (identifier) @function)))
|
||||||
|
|
||||||
|
; -- Variable & constant declarations
|
||||||
|
; (This is only questionable because we cannot detect types of identifiers
|
||||||
|
; declared in other units, so the results will be inconsistent)
|
||||||
|
|
||||||
|
(declVar name: (identifier) @variable)
|
||||||
|
(declField name: (identifier) @variable)
|
||||||
|
(declConst name: (identifier) @constant)
|
||||||
|
(declEnumValue name: (identifier) @constant)
|
||||||
|
|
||||||
|
; -- Identifier type inferrence
|
||||||
|
|
||||||
|
; vERY QUESTIONABLE: Highlighting of identifiers based on spelling
|
||||||
|
(exprBinary ((identifier) @constant
|
||||||
|
(#match? @constant "^[A-Z][A-Z0-9_]+$|^[a-z]{2}[A-Z].+$")))
|
||||||
|
(exprUnary ((identifier) @constant
|
||||||
|
(#match? @constant "^[A-Z][A-Z0-9_]+$|^[a-z]{2}[A-Z].+$")))
|
||||||
|
(assignment rhs: ((identifier) @constant
|
||||||
|
(#match? @constant "^[A-Z][A-Z0-9_]+$|^[a-z]{2}[A-Z].+$")))
|
||||||
|
(exprBrackets ((identifier) @constant
|
||||||
|
(#match? @constant "^[A-Z][A-Z0-9_]+$|^[a-z]{2}[A-Z].+$")))
|
||||||
|
(exprParens ((identifier) @constant
|
||||||
|
(#match? @constant "^[A-Z][A-Z0-9_]+$|^[a-z]{2}[A-Z].+$")))
|
||||||
|
;(exprDot rhs: ((identifier) @constant
|
||||||
|
; (#match? @constant "^[A-Z][A-Z0-9_]+$|^[a-z]{1,2}[A-Z].+$")))
|
||||||
|
(exprTpl args: ((identifier) @constant
|
||||||
|
(#match? @constant "^[A-Z][A-Z0-9_]+$|^[a-z]{2}[A-Z].+$")))
|
||||||
|
(exprArgs ((identifier) @constant
|
||||||
|
(#match? @constant "^[A-Z][A-Z0-9_]+$|^[a-z]{2}[A-Z].+$")))
|
||||||
|
;(declEnumValue ((identifier) @constant
|
||||||
|
; (#match? @constant "^[A-Z][A-Z0-9_]+$|^[a-z]{1,2}[A-Z].+$")))
|
||||||
|
;(defaultValue ((identifier) @constant
|
||||||
|
; (#match? @constant "^[A-Z][A-Z0-9_]+$|^[a-z]{1,2}[A-Z].+$")))
|
||||||
|
|
||||||
|
; -- Use scoping information for additional highlighting. THIS NEED TO BE LAST.
|
||||||
|
; FIXME: Right now this is buggy, because in case of something like this:
|
||||||
|
; procedure (x: integer);
|
||||||
|
; begin
|
||||||
|
; a.x;
|
||||||
|
; end;
|
||||||
|
; The x in a.x would be highlighted as a parameter. Not what we want! We have to
|
||||||
|
; come up with a more specific rule. Only the left-most identifier should be
|
||||||
|
; matched.
|
||||||
|
(identifier) @identifier
|
||||||
@ -1 +0,0 @@
|
|||||||
tree-sitter-pascal/src
|
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 350 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 345 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 225 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 171 KiB |
@ -1,26 +0,0 @@
|
|||||||
[package]
|
|
||||||
name = "tree-sitter-quick-check"
|
|
||||||
description = "quick-check grammar for the tree-sitter parsing library"
|
|
||||||
version = "0.0.1"
|
|
||||||
keywords = ["incremental", "parsing", "quick-check"]
|
|
||||||
categories = ["parsing", "text-editors"]
|
|
||||||
repository = "https://github.com/tree-sitter/tree-sitter-quick-check"
|
|
||||||
edition = "2018"
|
|
||||||
license = "MIT"
|
|
||||||
|
|
||||||
build = "bindings/rust/build.rs"
|
|
||||||
include = [
|
|
||||||
"bindings/rust/*",
|
|
||||||
"grammar.js",
|
|
||||||
"queries/*",
|
|
||||||
"src/*",
|
|
||||||
]
|
|
||||||
|
|
||||||
[lib]
|
|
||||||
path = "bindings/rust/lib.rs"
|
|
||||||
|
|
||||||
[dependencies]
|
|
||||||
tree-sitter = "~0.20.0"
|
|
||||||
|
|
||||||
[build-dependencies]
|
|
||||||
cc = "1.0"
|
|
||||||
@ -1,21 +0,0 @@
|
|||||||
MIT License
|
|
||||||
|
|
||||||
Copyright (c) 2018 Benjamin Gray
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all
|
|
||||||
copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
SOFTWARE.
|
|
||||||
@ -1,26 +0,0 @@
|
|||||||
# tree-sitter-pascal
|
|
||||||
|
|
||||||
Grammar for Pascal and its dialects Delphi and Freepascal.
|
|
||||||
|
|
||||||
## Supported language features
|
|
||||||
- Classes, records, interfaces, class helpers
|
|
||||||
- Nested declarations
|
|
||||||
- Variant records
|
|
||||||
- Generics (Delphi- & FPC flavored)
|
|
||||||
- Anonymous procedures & functions
|
|
||||||
- Inline assember (but no highlighting)
|
|
||||||
- Extended RTTI attributes
|
|
||||||
- FPC PasCocoa extensions
|
|
||||||
|
|
||||||
## Tree-sitter features:
|
|
||||||
- Syntax highlighting
|
|
||||||
- Scopes
|
|
||||||
|
|
||||||
## Screenshots
|
|
||||||
|
|
||||||
(using nvim-treesitter)
|
|
||||||
|
|
||||||
<a href=".doc/scr1.png"><img src=".doc/scr1.png" style="width: 22%; height: 22%"></a>
|
|
||||||
<a href=".doc/scr2.png"><img src=".doc/scr2.png" style="width: 22%; height: 22%"></a>
|
|
||||||
<a href=".doc/scr3.png"><img src=".doc/scr3.png" style="width: 22%; height: 22%"></a>
|
|
||||||
<a href=".doc/scr4.png"><img src=".doc/scr4.png" style="width: 22%; height: 22%"></a>
|
|
||||||
@ -1,19 +0,0 @@
|
|||||||
{
|
|
||||||
"targets": [
|
|
||||||
{
|
|
||||||
"target_name": "tree_sitter_quick_check_binding",
|
|
||||||
"include_dirs": [
|
|
||||||
"<!(node -e \"require('nan')\")",
|
|
||||||
"src"
|
|
||||||
],
|
|
||||||
"sources": [
|
|
||||||
"bindings/node/binding.cc",
|
|
||||||
"src/parser.c",
|
|
||||||
# If your language uses an external scanner, add it here.
|
|
||||||
],
|
|
||||||
"cflags_c": [
|
|
||||||
"-std=c99",
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
@ -1,38 +0,0 @@
|
|||||||
unit anon;
|
|
||||||
|
|
||||||
interface
|
|
||||||
|
|
||||||
implementation
|
|
||||||
|
|
||||||
function MakeAdder(y: Integer): TFuncOfInt;
|
|
||||||
begin
|
|
||||||
Result :=
|
|
||||||
function(x: Integer) : Integer
|
|
||||||
begin
|
|
||||||
Result := x + y;
|
|
||||||
end;
|
|
||||||
z := x + y;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure Test;
|
|
||||||
begin
|
|
||||||
x := procedure begin end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure Foo;
|
|
||||||
begin
|
|
||||||
Call(
|
|
||||||
procedure
|
|
||||||
var
|
|
||||||
x: integer;
|
|
||||||
begin
|
|
||||||
Inc(x);
|
|
||||||
end
|
|
||||||
);
|
|
||||||
end;
|
|
||||||
|
|
||||||
const
|
|
||||||
Bla = procedure begin WriteLn('Hello'); end;
|
|
||||||
|
|
||||||
|
|
||||||
end.
|
|
||||||
File diff suppressed because it is too large
Load Diff
@ -1,107 +0,0 @@
|
|||||||
unit unit1;
|
|
||||||
|
|
||||||
interface
|
|
||||||
|
|
||||||
type
|
|
||||||
TForm1 = class(TForm)
|
|
||||||
function Add(a,b: integer): integer;
|
|
||||||
function Baz(out Buf; Flag: string = '123'): integer;
|
|
||||||
public
|
|
||||||
constructor Create;
|
|
||||||
destructor Destroy; override;
|
|
||||||
end;
|
|
||||||
|
|
||||||
TMyRec = record
|
|
||||||
end;
|
|
||||||
|
|
||||||
var
|
|
||||||
a,b,c: float;
|
|
||||||
|
|
||||||
const
|
|
||||||
hello = 'world';
|
|
||||||
world: string = 'hello';
|
|
||||||
|
|
||||||
complex = not (42 + 3)*123 and $FF + integer(@world);
|
|
||||||
|
|
||||||
procedure Write(x: integer = 42);
|
|
||||||
|
|
||||||
type
|
|
||||||
|
|
||||||
TFoo1<A> = X;
|
|
||||||
TBar2<B,C> = X;
|
|
||||||
TBaz3<A: IContract> = X;
|
|
||||||
TBaz4<A,B: IContract> = TBar<X,Y>;
|
|
||||||
TBaz5<A;B: IContract> = X;
|
|
||||||
TFoo6<T> = class end;
|
|
||||||
TFoo7 = class(TCustomFoo<T>) end;
|
|
||||||
TFoo8<T> = class(TCustomFoo<T<U>>) end;
|
|
||||||
TFoo9<A, B; C, D: IContract> = class(TCustomFoo< T, U<W> >) end;
|
|
||||||
TFoo10<A, B; C, D: IContract> = TCustomFoo< T, U<W> >;
|
|
||||||
|
|
||||||
TMySet11 = set of Byte;
|
|
||||||
TMySet12 = set of (Watermelon, Cucumber);
|
|
||||||
|
|
||||||
TMeta13 = class of TFoo;
|
|
||||||
|
|
||||||
|
|
||||||
TMyCallback14 = procedure (Sender: TObject<T>); stdcall;
|
|
||||||
TMyCallback15 = procedure (Sender: TObject);
|
|
||||||
TMyCallback16 = function (Sender: TObject): integer;
|
|
||||||
TMyFunc17<T> = function (x,y: T; z: integer): TSomething<T>;
|
|
||||||
|
|
||||||
class procedure Foo<T = TObject>(X: T); static;
|
|
||||||
|
|
||||||
implementation
|
|
||||||
|
|
||||||
function Add(a, b: integer): integer;
|
|
||||||
var
|
|
||||||
c: integer;
|
|
||||||
begin
|
|
||||||
c := a + b;
|
|
||||||
Result := c;
|
|
||||||
|
|
||||||
TFoo1.Bar;
|
|
||||||
end;
|
|
||||||
|
|
||||||
class procedure Foo<T = TObject>(X: T); forward;
|
|
||||||
procedure Foo; forward;
|
|
||||||
|
|
||||||
function TFoo<T>.Impl.Add<T>(a, b: T; c: integer): T;
|
|
||||||
var
|
|
||||||
tmp: T;
|
|
||||||
|
|
||||||
procedure nested();
|
|
||||||
begin
|
|
||||||
tmp := a;
|
|
||||||
end;
|
|
||||||
begin
|
|
||||||
tmp := b;
|
|
||||||
end;
|
|
||||||
|
|
||||||
function Add<T>(a, b: T): T;
|
|
||||||
var
|
|
||||||
c: T;
|
|
||||||
begin
|
|
||||||
c.x.y.z := a + b;
|
|
||||||
Result := c;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure Foo(x: TType);
|
|
||||||
begin
|
|
||||||
a + b + c;
|
|
||||||
x.y.z(a,b).w + v and v;
|
|
||||||
x.y.z;
|
|
||||||
x;
|
|
||||||
x + y;
|
|
||||||
2.5 + 3.14*4;
|
|
||||||
Result := 2.4 + 3.14*4;
|
|
||||||
(a+b)*(c+d) and b >= c;
|
|
||||||
if a then b;
|
|
||||||
if a then b else c;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure Foobar(arr: array of integer);
|
|
||||||
begin
|
|
||||||
end;
|
|
||||||
|
|
||||||
end.
|
|
||||||
File diff suppressed because it is too large
Load Diff
@ -1,23 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "tree-sitter-pascal",
|
|
||||||
"version": "0.9.1",
|
|
||||||
"description": "Tree sitter grammar for Pascal (Delphi, Freepascal)",
|
|
||||||
"main": "bindings/node",
|
|
||||||
"repository": null,
|
|
||||||
"author": "Benjamin Gray",
|
|
||||||
"license": "MIT",
|
|
||||||
"devDependencies": {
|
|
||||||
"tree-sitter-cli": "^0.19.0"
|
|
||||||
},
|
|
||||||
"scripts": {
|
|
||||||
"build": "tree-sitter generate && node-gyp build",
|
|
||||||
"test": "tree-sitter test && tree-sitter parse examples/* --quiet --time"
|
|
||||||
},
|
|
||||||
"tree-sitter": [
|
|
||||||
{
|
|
||||||
"scope": "source.pas",
|
|
||||||
"file-types": ["pas", "pp", "lpr"],
|
|
||||||
"highlights": ["queries/highlights.scm"]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
@ -1,343 +0,0 @@
|
|||||||
; -- Keywords
|
|
||||||
[
|
|
||||||
(kProgram)
|
|
||||||
(kLibrary)
|
|
||||||
(kUnit)
|
|
||||||
(kUses)
|
|
||||||
|
|
||||||
(kBegin)
|
|
||||||
(kEnd)
|
|
||||||
(kAsm)
|
|
||||||
|
|
||||||
(kVar)
|
|
||||||
(kThreadvar)
|
|
||||||
(kConst)
|
|
||||||
(kResourcestring)
|
|
||||||
(kConstref)
|
|
||||||
(kOut)
|
|
||||||
(kType)
|
|
||||||
(kLabel)
|
|
||||||
(kExports)
|
|
||||||
|
|
||||||
(kAbsolute)
|
|
||||||
|
|
||||||
(kProperty)
|
|
||||||
(kRead)
|
|
||||||
(kWrite)
|
|
||||||
(kImplements)
|
|
||||||
(kDefault)
|
|
||||||
(kNodefault)
|
|
||||||
(kStored)
|
|
||||||
(kIndex)
|
|
||||||
|
|
||||||
(kClass)
|
|
||||||
(kInterface)
|
|
||||||
(kObject)
|
|
||||||
(kRecord)
|
|
||||||
(kObjcclass)
|
|
||||||
(kObjccategory)
|
|
||||||
(kObjcprotocol)
|
|
||||||
(kArray)
|
|
||||||
(kFile)
|
|
||||||
(kString)
|
|
||||||
(kSet)
|
|
||||||
(kOf)
|
|
||||||
(kHelper)
|
|
||||||
(kPacked)
|
|
||||||
|
|
||||||
(kGeneric)
|
|
||||||
(kSpecialize)
|
|
||||||
|
|
||||||
(kFunction)
|
|
||||||
(kProcedure)
|
|
||||||
(kConstructor)
|
|
||||||
(kDestructor)
|
|
||||||
(kOperator)
|
|
||||||
(kReference)
|
|
||||||
|
|
||||||
(kInterface)
|
|
||||||
(kImplementation)
|
|
||||||
(kInitialization)
|
|
||||||
(kFinalization)
|
|
||||||
|
|
||||||
(kPublished)
|
|
||||||
(kPublic)
|
|
||||||
(kProtected)
|
|
||||||
(kPrivate)
|
|
||||||
(kStrict)
|
|
||||||
(kRequired)
|
|
||||||
(kOptional)
|
|
||||||
|
|
||||||
(kForward)
|
|
||||||
|
|
||||||
(kStatic)
|
|
||||||
(kVirtual)
|
|
||||||
(kAbstract)
|
|
||||||
(kSealed)
|
|
||||||
(kDynamic)
|
|
||||||
(kOverride)
|
|
||||||
(kOverload)
|
|
||||||
(kReintroduce)
|
|
||||||
(kInherited)
|
|
||||||
(kInline)
|
|
||||||
|
|
||||||
(kStdcall)
|
|
||||||
(kCdecl)
|
|
||||||
(kCppdecl)
|
|
||||||
(kPascal)
|
|
||||||
(kRegister)
|
|
||||||
(kMwpascal)
|
|
||||||
(kExternal)
|
|
||||||
(kName)
|
|
||||||
(kMessage)
|
|
||||||
(kDeprecated)
|
|
||||||
(kExperimental)
|
|
||||||
(kPlatform)
|
|
||||||
(kUnimplemented)
|
|
||||||
(kCvar)
|
|
||||||
(kExport)
|
|
||||||
(kFar)
|
|
||||||
(kNear)
|
|
||||||
(kSafecall)
|
|
||||||
(kAssembler)
|
|
||||||
(kNostackframe)
|
|
||||||
(kInterrupt)
|
|
||||||
(kNoreturn)
|
|
||||||
(kIocheck)
|
|
||||||
(kLocal)
|
|
||||||
(kHardfloat)
|
|
||||||
(kSoftfloat)
|
|
||||||
(kMs_abi_default)
|
|
||||||
(kMs_abi_cdecl)
|
|
||||||
(kSaveregisters)
|
|
||||||
(kSysv_abi_default)
|
|
||||||
(kSysv_abi_cdecl)
|
|
||||||
(kVectorcall)
|
|
||||||
(kVarargs)
|
|
||||||
(kWinapi)
|
|
||||||
(kAlias)
|
|
||||||
(kDelayed)
|
|
||||||
|
|
||||||
(kFor)
|
|
||||||
(kTo)
|
|
||||||
(kDownto)
|
|
||||||
(kIf)
|
|
||||||
(kThen)
|
|
||||||
(kElse)
|
|
||||||
(kDo)
|
|
||||||
(kWhile)
|
|
||||||
(kRepeat)
|
|
||||||
(kUntil)
|
|
||||||
(kTry)
|
|
||||||
(kExcept)
|
|
||||||
(kFinally)
|
|
||||||
(kRaise)
|
|
||||||
(kOn)
|
|
||||||
(kCase)
|
|
||||||
(kWith)
|
|
||||||
(kGoto)
|
|
||||||
] @keyword
|
|
||||||
|
|
||||||
; -- Punctuation & operators
|
|
||||||
|
|
||||||
[
|
|
||||||
"("
|
|
||||||
")"
|
|
||||||
"["
|
|
||||||
"]"
|
|
||||||
] @punctuation.bracket
|
|
||||||
|
|
||||||
[
|
|
||||||
";"
|
|
||||||
","
|
|
||||||
":"
|
|
||||||
".."
|
|
||||||
(kEndDot)
|
|
||||||
] @punctuation.delimiter
|
|
||||||
|
|
||||||
[
|
|
||||||
(kDot)
|
|
||||||
(kAdd)
|
|
||||||
(kSub)
|
|
||||||
(kMul)
|
|
||||||
(kFdiv)
|
|
||||||
(kAssign)
|
|
||||||
(kAssignAdd)
|
|
||||||
(kAssignSub)
|
|
||||||
(kAssignMul)
|
|
||||||
(kAssignDiv)
|
|
||||||
(kEq)
|
|
||||||
(kLt)
|
|
||||||
(kLte)
|
|
||||||
(kGt)
|
|
||||||
(kGte)
|
|
||||||
(kNeq)
|
|
||||||
(kAt)
|
|
||||||
(kHat)
|
|
||||||
] @operator
|
|
||||||
|
|
||||||
; technically operators, but better to render as reserved words
|
|
||||||
[
|
|
||||||
(kOr)
|
|
||||||
(kXor)
|
|
||||||
(kDiv)
|
|
||||||
(kMod)
|
|
||||||
(kAnd)
|
|
||||||
(kShl)
|
|
||||||
(kShr)
|
|
||||||
(kNot)
|
|
||||||
(kIs)
|
|
||||||
(kAs)
|
|
||||||
(kIn)
|
|
||||||
] @keyword
|
|
||||||
|
|
||||||
; -- Builtin constants
|
|
||||||
|
|
||||||
[
|
|
||||||
(kTrue)
|
|
||||||
(kFalse)
|
|
||||||
] @constant;
|
|
||||||
|
|
||||||
; arguably a constant, but we highlight it as a keyword
|
|
||||||
[
|
|
||||||
(kNil)
|
|
||||||
] @keyword
|
|
||||||
|
|
||||||
; -- Literals
|
|
||||||
|
|
||||||
(literalNumber) @number
|
|
||||||
(literalString) @string
|
|
||||||
|
|
||||||
; -- Comments
|
|
||||||
(comment) @comment
|
|
||||||
(pp) @keyword
|
|
||||||
|
|
||||||
; -- Type declaration
|
|
||||||
|
|
||||||
(declType name: (identifier) @type)
|
|
||||||
(declType name: (genericTpl entity: (identifier) @type))
|
|
||||||
|
|
||||||
; -- Procedure & function declarations
|
|
||||||
|
|
||||||
; foobar
|
|
||||||
(declProc name: (identifier) @function)
|
|
||||||
; foobar<t>
|
|
||||||
(declProc name: (genericTpl entity: (identifier) @function))
|
|
||||||
; foo.bar
|
|
||||||
(declProc name: (genericDot rhs: (identifier) @function))
|
|
||||||
; foo.bar<t>
|
|
||||||
(declProc name: (genericDot rhs: (genericTpl entity: (identifier) @function)))
|
|
||||||
|
|
||||||
; Treat property declarations like functions
|
|
||||||
|
|
||||||
(declProp name: (identifier) @function)
|
|
||||||
|
|
||||||
; -- Function parameters
|
|
||||||
|
|
||||||
(declArg name: (identifier) @variable.parameter)
|
|
||||||
|
|
||||||
; -- Template parameters
|
|
||||||
|
|
||||||
(genericArg name: (identifier) @type.parameter)
|
|
||||||
(genericArg type: (typeref) @type)
|
|
||||||
|
|
||||||
(genericDot (identifier) @type)
|
|
||||||
(genericDot (genericTpl entity: (identifier) @type))
|
|
||||||
|
|
||||||
; -- Exception parameters
|
|
||||||
(exceptionHandler variable: (identifier) @variable.parameter)
|
|
||||||
|
|
||||||
; -- Type usage
|
|
||||||
|
|
||||||
(typeref) @type
|
|
||||||
|
|
||||||
; -- Constant usage
|
|
||||||
|
|
||||||
[
|
|
||||||
(caseLabel)
|
|
||||||
(label)
|
|
||||||
] @constant;
|
|
||||||
|
|
||||||
|
|
||||||
;;; ---------------------------------------------- ;;;
|
|
||||||
;;; EVERYTHING BELOW THIS IS OF QUESTIONABLE VALUE ;;;
|
|
||||||
;;; ---------------------------------------------- ;;;
|
|
||||||
|
|
||||||
; -- Break, Continue & Exit
|
|
||||||
; (Not ideal: ideally, there would be a way to check if these special
|
|
||||||
; identifiers are shadowed by a local variable)
|
|
||||||
(statement ((identifier) @keyword
|
|
||||||
(#match? @keyword "^[eE][xX][iI][tT]$")))
|
|
||||||
(statement (exprCall entity: ((identifier) @keyword
|
|
||||||
(#match? @keyword "^[eE][xX][iI][tT]$"))))
|
|
||||||
(statement ((identifier) @keyword
|
|
||||||
(#match? @keyword "^[bB][rR][eE][aA][kK]$")))
|
|
||||||
(statement ((identifier) @keyword
|
|
||||||
(#match? @keyword "^[cC][oO][nN][tT][iI][nN][uU][eE]$")))
|
|
||||||
|
|
||||||
; -- Procedure name in calls with parentheses
|
|
||||||
; (Pascal doesn't require parentheses for procedure calls, so this will not
|
|
||||||
; detect all calls)
|
|
||||||
|
|
||||||
; foobar
|
|
||||||
(exprCall entity: (identifier) @function)
|
|
||||||
; foobar<t>
|
|
||||||
(exprCall entity: (exprTpl entity: (identifier) @function))
|
|
||||||
; foo.bar
|
|
||||||
(exprCall entity: (exprDot rhs: (identifier) @function))
|
|
||||||
; foo.bar<t>
|
|
||||||
(exprCall entity: (exprDot rhs: (exprTpl entity: (identifier) @function)))
|
|
||||||
|
|
||||||
; -- Heuristic for procedure/function calls without parentheses
|
|
||||||
; (If a statement consists only of an identifier, assume it's a procedure)
|
|
||||||
; (This will still not match all procedure calls, and also may produce false
|
|
||||||
; positives in rare cases, but only for nonsensical code)
|
|
||||||
|
|
||||||
(statement (identifier) @function)
|
|
||||||
(statement (exprDot rhs: (identifier) @function))
|
|
||||||
(statement (exprTpl entity: (identifier) @function))
|
|
||||||
(statement (exprDot rhs: (exprTpl entity: (identifier) @function)))
|
|
||||||
|
|
||||||
; -- Variable & constant declarations
|
|
||||||
; (This is only questionable because we cannot detect types of identifiers
|
|
||||||
; declared in other units, so the results will be inconsistent)
|
|
||||||
|
|
||||||
(declVar name: (identifier) @variable)
|
|
||||||
(declField name: (identifier) @variable)
|
|
||||||
(declConst name: (identifier) @constant)
|
|
||||||
(declEnumValue name: (identifier) @constant)
|
|
||||||
|
|
||||||
; -- Identifier type inferrence
|
|
||||||
|
|
||||||
; vERY QUESTIONABLE: Highlighting of identifiers based on spelling
|
|
||||||
(exprBinary ((identifier) @constant
|
|
||||||
(#match? @constant "^[A-Z][A-Z0-9_]+$|^[a-z]{2}[A-Z].+$")))
|
|
||||||
(exprUnary ((identifier) @constant
|
|
||||||
(#match? @constant "^[A-Z][A-Z0-9_]+$|^[a-z]{2}[A-Z].+$")))
|
|
||||||
(assignment rhs: ((identifier) @constant
|
|
||||||
(#match? @constant "^[A-Z][A-Z0-9_]+$|^[a-z]{2}[A-Z].+$")))
|
|
||||||
(exprBrackets ((identifier) @constant
|
|
||||||
(#match? @constant "^[A-Z][A-Z0-9_]+$|^[a-z]{2}[A-Z].+$")))
|
|
||||||
(exprParens ((identifier) @constant
|
|
||||||
(#match? @constant "^[A-Z][A-Z0-9_]+$|^[a-z]{2}[A-Z].+$")))
|
|
||||||
;(exprDot rhs: ((identifier) @constant
|
|
||||||
; (#match? @constant "^[A-Z][A-Z0-9_]+$|^[a-z]{1,2}[A-Z].+$")))
|
|
||||||
(exprTpl args: ((identifier) @constant
|
|
||||||
(#match? @constant "^[A-Z][A-Z0-9_]+$|^[a-z]{2}[A-Z].+$")))
|
|
||||||
(exprArgs ((identifier) @constant
|
|
||||||
(#match? @constant "^[A-Z][A-Z0-9_]+$|^[a-z]{2}[A-Z].+$")))
|
|
||||||
;(declEnumValue ((identifier) @constant
|
|
||||||
; (#match? @constant "^[A-Z][A-Z0-9_]+$|^[a-z]{1,2}[A-Z].+$")))
|
|
||||||
;(defaultValue ((identifier) @constant
|
|
||||||
; (#match? @constant "^[A-Z][A-Z0-9_]+$|^[a-z]{1,2}[A-Z].+$")))
|
|
||||||
|
|
||||||
; -- Use scoping information for additional highlighting. THIS NEED TO BE LAST.
|
|
||||||
; FIXME: Right now this is buggy, because in case of something like this:
|
|
||||||
; procedure (x: integer);
|
|
||||||
; begin
|
|
||||||
; a.x;
|
|
||||||
; end;
|
|
||||||
; The x in a.x would be highlighted as a parameter. Not what we want! We have to
|
|
||||||
; come up with a more specific rule. Only the left-most identifier should be
|
|
||||||
; matched.
|
|
||||||
(identifier) @identifier
|
|
||||||
@ -1,26 +0,0 @@
|
|||||||
|
|
||||||
(root) @local.scope
|
|
||||||
|
|
||||||
(defProc) @local.scope
|
|
||||||
(lambda) @local.scope
|
|
||||||
(interface (declProc) @local.scope)
|
|
||||||
(declSection (declProc) @local.scope)
|
|
||||||
(declClass (declProc) @local.scope)
|
|
||||||
(declHelper (declProc) @local.scope)
|
|
||||||
(declProcRef) @local.scope
|
|
||||||
|
|
||||||
(exceptionHandler) @local.scope
|
|
||||||
(exceptionHandler variable: (identifier) @local.definition)
|
|
||||||
|
|
||||||
(declArg name: (identifier) @local.definition)
|
|
||||||
(declVar name: (identifier) @local.definition)
|
|
||||||
(declConst name: (identifier) @local.definition)
|
|
||||||
(declLabel name: (identifier) @local.definition)
|
|
||||||
(genericArg name: (identifier) @local.definition)
|
|
||||||
(declEnumValue name: (identifier) @local.definition)
|
|
||||||
(declType name: (identifier) @local.definition)
|
|
||||||
(declType name: (genericTpl entity: (identifier) @local.definition))
|
|
||||||
|
|
||||||
(declProc name: (identifier) @local.definition)
|
|
||||||
|
|
||||||
(identifier) @local.reference
|
|
||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,223 +0,0 @@
|
|||||||
#ifndef TREE_SITTER_PARSER_H_
|
|
||||||
#define TREE_SITTER_PARSER_H_
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <stdbool.h>
|
|
||||||
#include <stdint.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
#define ts_builtin_sym_error ((TSSymbol)-1)
|
|
||||||
#define ts_builtin_sym_end 0
|
|
||||||
#define TREE_SITTER_SERIALIZATION_BUFFER_SIZE 1024
|
|
||||||
|
|
||||||
typedef uint16_t TSStateId;
|
|
||||||
|
|
||||||
#ifndef TREE_SITTER_API_H_
|
|
||||||
typedef uint16_t TSSymbol;
|
|
||||||
typedef uint16_t TSFieldId;
|
|
||||||
typedef struct TSLanguage TSLanguage;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
TSFieldId field_id;
|
|
||||||
uint8_t child_index;
|
|
||||||
bool inherited;
|
|
||||||
} TSFieldMapEntry;
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
uint16_t index;
|
|
||||||
uint16_t length;
|
|
||||||
} TSFieldMapSlice;
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
bool visible;
|
|
||||||
bool named;
|
|
||||||
bool supertype;
|
|
||||||
} TSSymbolMetadata;
|
|
||||||
|
|
||||||
typedef struct TSLexer TSLexer;
|
|
||||||
|
|
||||||
struct TSLexer {
|
|
||||||
int32_t lookahead;
|
|
||||||
TSSymbol result_symbol;
|
|
||||||
void (*advance)(TSLexer *, bool);
|
|
||||||
void (*mark_end)(TSLexer *);
|
|
||||||
uint32_t (*get_column)(TSLexer *);
|
|
||||||
bool (*is_at_included_range_start)(const TSLexer *);
|
|
||||||
bool (*eof)(const TSLexer *);
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef enum {
|
|
||||||
TSParseActionTypeShift,
|
|
||||||
TSParseActionTypeReduce,
|
|
||||||
TSParseActionTypeAccept,
|
|
||||||
TSParseActionTypeRecover,
|
|
||||||
} TSParseActionType;
|
|
||||||
|
|
||||||
typedef union {
|
|
||||||
struct {
|
|
||||||
uint8_t type;
|
|
||||||
TSStateId state;
|
|
||||||
bool extra;
|
|
||||||
bool repetition;
|
|
||||||
} shift;
|
|
||||||
struct {
|
|
||||||
uint8_t type;
|
|
||||||
uint8_t child_count;
|
|
||||||
TSSymbol symbol;
|
|
||||||
int16_t dynamic_precedence;
|
|
||||||
uint16_t production_id;
|
|
||||||
} reduce;
|
|
||||||
uint8_t type;
|
|
||||||
} TSParseAction;
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
uint16_t lex_state;
|
|
||||||
uint16_t external_lex_state;
|
|
||||||
} TSLexMode;
|
|
||||||
|
|
||||||
typedef union {
|
|
||||||
TSParseAction action;
|
|
||||||
struct {
|
|
||||||
uint8_t count;
|
|
||||||
bool reusable;
|
|
||||||
} entry;
|
|
||||||
} TSParseActionEntry;
|
|
||||||
|
|
||||||
struct TSLanguage {
|
|
||||||
uint32_t version;
|
|
||||||
uint32_t symbol_count;
|
|
||||||
uint32_t alias_count;
|
|
||||||
uint32_t token_count;
|
|
||||||
uint32_t external_token_count;
|
|
||||||
uint32_t state_count;
|
|
||||||
uint32_t large_state_count;
|
|
||||||
uint32_t production_id_count;
|
|
||||||
uint32_t field_count;
|
|
||||||
uint16_t max_alias_sequence_length;
|
|
||||||
const uint16_t *parse_table;
|
|
||||||
const uint16_t *small_parse_table;
|
|
||||||
const uint32_t *small_parse_table_map;
|
|
||||||
const TSParseActionEntry *parse_actions;
|
|
||||||
const char * const *symbol_names;
|
|
||||||
const char * const *field_names;
|
|
||||||
const TSFieldMapSlice *field_map_slices;
|
|
||||||
const TSFieldMapEntry *field_map_entries;
|
|
||||||
const TSSymbolMetadata *symbol_metadata;
|
|
||||||
const TSSymbol *public_symbol_map;
|
|
||||||
const uint16_t *alias_map;
|
|
||||||
const TSSymbol *alias_sequences;
|
|
||||||
const TSLexMode *lex_modes;
|
|
||||||
bool (*lex_fn)(TSLexer *, TSStateId);
|
|
||||||
bool (*keyword_lex_fn)(TSLexer *, TSStateId);
|
|
||||||
TSSymbol keyword_capture_token;
|
|
||||||
struct {
|
|
||||||
const bool *states;
|
|
||||||
const TSSymbol *symbol_map;
|
|
||||||
void *(*create)(void);
|
|
||||||
void (*destroy)(void *);
|
|
||||||
bool (*scan)(void *, TSLexer *, const bool *symbol_whitelist);
|
|
||||||
unsigned (*serialize)(void *, char *);
|
|
||||||
void (*deserialize)(void *, const char *, unsigned);
|
|
||||||
} external_scanner;
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Lexer Macros
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define START_LEXER() \
|
|
||||||
bool result = false; \
|
|
||||||
bool skip = false; \
|
|
||||||
bool eof = false; \
|
|
||||||
int32_t lookahead; \
|
|
||||||
goto start; \
|
|
||||||
next_state: \
|
|
||||||
lexer->advance(lexer, skip); \
|
|
||||||
start: \
|
|
||||||
skip = false; \
|
|
||||||
lookahead = lexer->lookahead;
|
|
||||||
|
|
||||||
#define ADVANCE(state_value) \
|
|
||||||
{ \
|
|
||||||
state = state_value; \
|
|
||||||
goto next_state; \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define SKIP(state_value) \
|
|
||||||
{ \
|
|
||||||
skip = true; \
|
|
||||||
state = state_value; \
|
|
||||||
goto next_state; \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define ACCEPT_TOKEN(symbol_value) \
|
|
||||||
result = true; \
|
|
||||||
lexer->result_symbol = symbol_value; \
|
|
||||||
lexer->mark_end(lexer);
|
|
||||||
|
|
||||||
#define END_STATE() return result;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Parse Table Macros
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define SMALL_STATE(id) id - LARGE_STATE_COUNT
|
|
||||||
|
|
||||||
#define STATE(id) id
|
|
||||||
|
|
||||||
#define ACTIONS(id) id
|
|
||||||
|
|
||||||
#define SHIFT(state_value) \
|
|
||||||
{{ \
|
|
||||||
.shift = { \
|
|
||||||
.type = TSParseActionTypeShift, \
|
|
||||||
.state = state_value \
|
|
||||||
} \
|
|
||||||
}}
|
|
||||||
|
|
||||||
#define SHIFT_REPEAT(state_value) \
|
|
||||||
{{ \
|
|
||||||
.shift = { \
|
|
||||||
.type = TSParseActionTypeShift, \
|
|
||||||
.state = state_value, \
|
|
||||||
.repetition = true \
|
|
||||||
} \
|
|
||||||
}}
|
|
||||||
|
|
||||||
#define SHIFT_EXTRA() \
|
|
||||||
{{ \
|
|
||||||
.shift = { \
|
|
||||||
.type = TSParseActionTypeShift, \
|
|
||||||
.extra = true \
|
|
||||||
} \
|
|
||||||
}}
|
|
||||||
|
|
||||||
#define REDUCE(symbol_val, child_count_val, ...) \
|
|
||||||
{{ \
|
|
||||||
.reduce = { \
|
|
||||||
.type = TSParseActionTypeReduce, \
|
|
||||||
.symbol = symbol_val, \
|
|
||||||
.child_count = child_count_val, \
|
|
||||||
__VA_ARGS__ \
|
|
||||||
}, \
|
|
||||||
}}
|
|
||||||
|
|
||||||
#define RECOVER() \
|
|
||||||
{{ \
|
|
||||||
.type = TSParseActionTypeRecover \
|
|
||||||
}}
|
|
||||||
|
|
||||||
#define ACCEPT_INPUT() \
|
|
||||||
{{ \
|
|
||||||
.type = TSParseActionTypeAccept \
|
|
||||||
}}
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif // TREE_SITTER_PARSER_H_
|
|
||||||
@ -1,185 +0,0 @@
|
|||||||
===
|
|
||||||
Declaration hints
|
|
||||||
===
|
|
||||||
|
|
||||||
procedure a; cdecl; forward;
|
|
||||||
procedure a; pascal; forward;
|
|
||||||
procedure a; stdcall; forward;
|
|
||||||
procedure a; register; forward;
|
|
||||||
procedure a; external b;
|
|
||||||
procedure a; cdecl; external b;
|
|
||||||
procedure a; external name b;
|
|
||||||
procedure a; external index b;
|
|
||||||
procedure a; external b name c;
|
|
||||||
procedure a; public name b; forward;
|
|
||||||
procedure a; inline; forward;
|
|
||||||
|
|
||||||
var
|
|
||||||
a: b; cvar; external c;
|
|
||||||
|
|
||||||
type
|
|
||||||
a = class
|
|
||||||
procedure b; message c;
|
|
||||||
procedure b; virtual; abstract;
|
|
||||||
procedure b; override;
|
|
||||||
procedure b; stdcall;
|
|
||||||
property b[i: integer]: c read getb; default;
|
|
||||||
end;
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
(root
|
|
||||||
(declProc (kProcedure) (identifier) (procAttribute (kCdecl)) (kForward))
|
|
||||||
(declProc (kProcedure) (identifier) (procAttribute (kPascal)) (kForward))
|
|
||||||
(declProc (kProcedure) (identifier) (procAttribute (kStdcall)) (kForward))
|
|
||||||
(declProc (kProcedure) (identifier) (procAttribute (kRegister)) (kForward))
|
|
||||||
(declProc (kProcedure) (identifier) (procExternal (kExternal) (identifier)))
|
|
||||||
(declProc (kProcedure) (identifier) (procAttribute (kCdecl)) (procExternal (kExternal) (identifier)))
|
|
||||||
(declProc (kProcedure) (identifier) (procExternal (kExternal) (kName) (identifier)))
|
|
||||||
(declProc (kProcedure) (identifier) (procExternal (kExternal) (kIndex) (identifier)))
|
|
||||||
(declProc (kProcedure) (identifier) (procExternal (kExternal) (identifier) (kName) (identifier)))
|
|
||||||
(declProc (kProcedure) (identifier) (procAttribute (kPublic) (kName) (identifier)) (kForward))
|
|
||||||
(declProc (kProcedure) (identifier) (procAttribute (kInline)) (kForward))
|
|
||||||
(declVars (kVar)
|
|
||||||
(declVar
|
|
||||||
(identifier)
|
|
||||||
(type (typeref (identifier)))
|
|
||||||
(procAttribute (kCvar))
|
|
||||||
(procExternal (kExternal) (identifier))))
|
|
||||||
(declTypes (kType)
|
|
||||||
(declType (identifier) (kEq)
|
|
||||||
(declClass (kClass)
|
|
||||||
(declProc (kProcedure) (identifier) (procAttribute (kMessage) (identifier)))
|
|
||||||
(declProc (kProcedure) (identifier) (procAttribute (kVirtual)) (procAttribute (kAbstract)))
|
|
||||||
(declProc (kProcedure) (identifier) (procAttribute (kOverride)))
|
|
||||||
(declProc (kProcedure) (identifier) (procAttribute (kStdcall)))
|
|
||||||
(declProp (kProperty)
|
|
||||||
(identifier)
|
|
||||||
(declPropArgs
|
|
||||||
(declArg
|
|
||||||
(identifier)
|
|
||||||
(type (typeref (identifier)))))
|
|
||||||
(type (typeref (identifier)))
|
|
||||||
(kRead) (identifier)
|
|
||||||
(procAttribute (kDefault)))
|
|
||||||
(kEnd)))))
|
|
||||||
|
|
||||||
|
|
||||||
===
|
|
||||||
FPC-style declaration hints
|
|
||||||
===
|
|
||||||
|
|
||||||
procedure a; [public; alias: b; cdecl]; forward;
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
(root
|
|
||||||
(declProc (kProcedure) (identifier)
|
|
||||||
(procAttribute (kPublic))
|
|
||||||
(procAttribute (kAlias) (identifier))
|
|
||||||
(procAttribute (kCdecl))
|
|
||||||
(kForward)))
|
|
||||||
|
|
||||||
|
|
||||||
===
|
|
||||||
Extended RTTI
|
|
||||||
===
|
|
||||||
|
|
||||||
type
|
|
||||||
[TMyAttribute]
|
|
||||||
TTestClass = class
|
|
||||||
[TMyAttribute('Test')]
|
|
||||||
property Test: LongInt read fTest;
|
|
||||||
[TMyAttribute()]
|
|
||||||
[TMyAttribute(1), TMyAttribute(2)]
|
|
||||||
procedure a;
|
|
||||||
end;
|
|
||||||
|
|
||||||
[TMyAttribute(1234)]
|
|
||||||
[TMy('Hello World')]
|
|
||||||
TTestEnum = (teOne, teTwo);
|
|
||||||
|
|
||||||
[TMyAttribute(IInterface), TMy(42)]
|
|
||||||
TLongInt = type LongInt;
|
|
||||||
|
|
||||||
TMyIntf = interface
|
|
||||||
['eff222cf-7d8d-481f-9fc4-d60e128983ab']
|
|
||||||
[TMyAttribute(1234)]
|
|
||||||
procedure foo;
|
|
||||||
end;
|
|
||||||
|
|
||||||
var
|
|
||||||
[TMyAttribute]
|
|
||||||
a: integer;
|
|
||||||
|
|
||||||
[TMyAttribute]
|
|
||||||
procedure foo;
|
|
||||||
begin
|
|
||||||
end;
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
(root
|
|
||||||
(declTypes (kType)
|
|
||||||
(declType
|
|
||||||
(rttiAttributes (identifier))
|
|
||||||
(identifier) (kEq) (declClass (kClass)
|
|
||||||
(declProp
|
|
||||||
(rttiAttributes
|
|
||||||
(exprCall (identifier) (exprArgs (literalString))))
|
|
||||||
(kProperty)
|
|
||||||
(identifier)
|
|
||||||
(type (typeref (identifier)))
|
|
||||||
(kRead)
|
|
||||||
(identifier))
|
|
||||||
(declProc
|
|
||||||
(rttiAttributes
|
|
||||||
(exprCall (identifier))
|
|
||||||
(exprCall (identifier) (exprArgs (literalNumber)))
|
|
||||||
(exprCall (identifier) (exprArgs (literalNumber))))
|
|
||||||
(kProcedure)
|
|
||||||
(identifier))
|
|
||||||
(kEnd)))
|
|
||||||
(declType
|
|
||||||
(rttiAttributes
|
|
||||||
(exprCall (identifier) (exprArgs (literalNumber)))
|
|
||||||
(exprCall (identifier) (exprArgs (literalString))))
|
|
||||||
(identifier)
|
|
||||||
(kEq)
|
|
||||||
(type
|
|
||||||
(declEnum
|
|
||||||
(declEnumValue (identifier))
|
|
||||||
(declEnumValue (identifier)))))
|
|
||||||
(declType
|
|
||||||
(rttiAttributes
|
|
||||||
(exprCall (identifier) (exprArgs (identifier)))
|
|
||||||
(exprCall (identifier) (exprArgs (literalNumber))))
|
|
||||||
(identifier)
|
|
||||||
(kEq)
|
|
||||||
(kType)
|
|
||||||
(type (typeref (identifier))))
|
|
||||||
(declType (identifier) (kEq)
|
|
||||||
(declIntf
|
|
||||||
(kInterface)
|
|
||||||
(guid (literalString))
|
|
||||||
(declProc
|
|
||||||
(rttiAttributes
|
|
||||||
(exprCall (identifier) (exprArgs (literalNumber))))
|
|
||||||
(kProcedure)
|
|
||||||
(identifier))
|
|
||||||
(kEnd))))
|
|
||||||
(declVars
|
|
||||||
(kVar)
|
|
||||||
(declVar
|
|
||||||
(rttiAttributes (identifier))
|
|
||||||
(identifier)
|
|
||||||
(type (typeref (identifier)))))
|
|
||||||
(defProc
|
|
||||||
(declProc
|
|
||||||
(rttiAttributes (identifier))
|
|
||||||
(kProcedure)
|
|
||||||
(identifier))
|
|
||||||
(block
|
|
||||||
(kBegin)
|
|
||||||
(kEnd))))
|
|
||||||
|
|
||||||
@ -1,725 +0,0 @@
|
|||||||
===
|
|
||||||
Variables
|
|
||||||
===
|
|
||||||
|
|
||||||
var
|
|
||||||
a: b;
|
|
||||||
a, b: c;
|
|
||||||
a: b = c;
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
(root
|
|
||||||
(declVars
|
|
||||||
(kVar)
|
|
||||||
(declVar (identifier)
|
|
||||||
(type (typeref (identifier))))
|
|
||||||
(declVar
|
|
||||||
(identifier)
|
|
||||||
(identifier)
|
|
||||||
(type (typeref (identifier))))
|
|
||||||
(declVar
|
|
||||||
(identifier)
|
|
||||||
(type (typeref (identifier)))
|
|
||||||
(defaultValue (kEq) (identifier)))))
|
|
||||||
|
|
||||||
===
|
|
||||||
Constants
|
|
||||||
===
|
|
||||||
|
|
||||||
const
|
|
||||||
a = b;
|
|
||||||
a: b = c;
|
|
||||||
|
|
||||||
resourcestring
|
|
||||||
a = b;
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
(root
|
|
||||||
(declConsts
|
|
||||||
(kConst)
|
|
||||||
(declConst (identifier)
|
|
||||||
(defaultValue (kEq) (identifier)))
|
|
||||||
(declConst
|
|
||||||
(identifier)
|
|
||||||
(type (typeref (identifier)))
|
|
||||||
(defaultValue (kEq) (identifier))))
|
|
||||||
(declConsts
|
|
||||||
(kResourcestring)
|
|
||||||
(declConst (identifier)
|
|
||||||
(defaultValue (kEq) (identifier)))))
|
|
||||||
|
|
||||||
===
|
|
||||||
Typedefs
|
|
||||||
===
|
|
||||||
|
|
||||||
type
|
|
||||||
a = b;
|
|
||||||
a = (b, c);
|
|
||||||
a = array of b;
|
|
||||||
a = array [0..1] of b;
|
|
||||||
a = set of b;
|
|
||||||
a = set of (b, c);
|
|
||||||
a = string[1];
|
|
||||||
a = class;
|
|
||||||
a = class(b);
|
|
||||||
a = class of b;
|
|
||||||
a = interface;
|
|
||||||
a = interface(b);
|
|
||||||
a = file;
|
|
||||||
a = file of b;
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
(root
|
|
||||||
(declTypes
|
|
||||||
(kType)
|
|
||||||
(declType (identifier) (kEq)
|
|
||||||
(type (typeref (identifier))))
|
|
||||||
(declType (identifier) (kEq)
|
|
||||||
(type
|
|
||||||
(declEnum
|
|
||||||
(declEnumValue (identifier))
|
|
||||||
(declEnumValue (identifier)))))
|
|
||||||
(declType (identifier) (kEq)
|
|
||||||
(type
|
|
||||||
(declArray (kArray) (kOf) (type (typeref (identifier))))))
|
|
||||||
(declType (identifier) (kEq)
|
|
||||||
(type
|
|
||||||
(declArray (kArray) (range (literalNumber) (literalNumber)) (kOf)
|
|
||||||
(type
|
|
||||||
(typeref (identifier))))))
|
|
||||||
(declType (identifier) (kEq)
|
|
||||||
(type
|
|
||||||
(declSet (kSet) (kOf)
|
|
||||||
(type
|
|
||||||
(typeref (identifier))))))
|
|
||||||
(declType (identifier) (kEq)
|
|
||||||
(type
|
|
||||||
(declSet (kSet) (kOf)
|
|
||||||
(type
|
|
||||||
(declEnum
|
|
||||||
(declEnumValue (identifier))
|
|
||||||
(declEnumValue (identifier)))))))
|
|
||||||
(declType (identifier) (kEq)
|
|
||||||
(type
|
|
||||||
(declString (kString) (literalNumber))))
|
|
||||||
(declType (identifier) (kEq)
|
|
||||||
(declClass (kClass)))
|
|
||||||
(declType (identifier) (kEq)
|
|
||||||
(declClass (kClass)
|
|
||||||
(typeref (identifier))))
|
|
||||||
(declType (identifier) (kEq)
|
|
||||||
(type
|
|
||||||
(declMetaClass (kClass) (kOf) (typeref (identifier)))))
|
|
||||||
(declType (identifier) (kEq)
|
|
||||||
(declIntf (kInterface)))
|
|
||||||
(declType (identifier) (kEq)
|
|
||||||
(declIntf (kInterface)
|
|
||||||
(typeref (identifier))))
|
|
||||||
(declType (identifier) (kEq)
|
|
||||||
(type
|
|
||||||
(declFile (kFile))))
|
|
||||||
(declType (identifier) (kEq)
|
|
||||||
(type
|
|
||||||
(declFile (kFile) (kOf)
|
|
||||||
(type
|
|
||||||
(typeref (identifier))))))))
|
|
||||||
|
|
||||||
|
|
||||||
===
|
|
||||||
Procedure references
|
|
||||||
===
|
|
||||||
|
|
||||||
type
|
|
||||||
a = procedure;
|
|
||||||
a = procedure(b: c);
|
|
||||||
a = function: b;
|
|
||||||
a = function(b: c): d;
|
|
||||||
|
|
||||||
a = procedure of object;
|
|
||||||
a = procedure(b:c) of object;
|
|
||||||
a = function: b of object;
|
|
||||||
a = function(b: c): d of object;
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
(root
|
|
||||||
(declTypes (kType)
|
|
||||||
(declType (identifier) (kEq)
|
|
||||||
(type
|
|
||||||
(declProcRef (kProcedure))))
|
|
||||||
(declType (identifier) (kEq)
|
|
||||||
(type
|
|
||||||
(declProcRef (kProcedure)
|
|
||||||
(declArgs
|
|
||||||
(declArg
|
|
||||||
(identifier)
|
|
||||||
(type (typeref (identifier))))))))
|
|
||||||
(declType (identifier) (kEq)
|
|
||||||
(type
|
|
||||||
(declProcRef (kFunction)
|
|
||||||
(typeref (identifier)))))
|
|
||||||
(declType (identifier) (kEq)
|
|
||||||
(type
|
|
||||||
(declProcRef (kFunction)
|
|
||||||
(declArgs
|
|
||||||
(declArg
|
|
||||||
(identifier)
|
|
||||||
(type (typeref (identifier)))))
|
|
||||||
(typeref (identifier)))))
|
|
||||||
(declType (identifier) (kEq)
|
|
||||||
(type
|
|
||||||
(declProcRef (kProcedure) (kOf) (kObject))))
|
|
||||||
(declType (identifier) (kEq)
|
|
||||||
(type
|
|
||||||
(declProcRef (kProcedure)
|
|
||||||
(declArgs
|
|
||||||
(declArg
|
|
||||||
(identifier)
|
|
||||||
(type (typeref (identifier)))))
|
|
||||||
(kOf) (kObject))))
|
|
||||||
(declType (identifier) (kEq)
|
|
||||||
(type
|
|
||||||
(declProcRef (kFunction)
|
|
||||||
(typeref (identifier))
|
|
||||||
(kOf) (kObject))))
|
|
||||||
(declType (identifier) (kEq)
|
|
||||||
(type
|
|
||||||
(declProcRef (kFunction)
|
|
||||||
(declArgs
|
|
||||||
(declArg
|
|
||||||
(identifier)
|
|
||||||
(type (typeref (identifier)))))
|
|
||||||
(typeref (identifier))
|
|
||||||
(kOf) (kObject))))))
|
|
||||||
|
|
||||||
===
|
|
||||||
Forward declarations
|
|
||||||
===
|
|
||||||
|
|
||||||
procedure a; forward;
|
|
||||||
procedure a(b: c); forward;
|
|
||||||
procedure a(b, c: d; e: f); forward;
|
|
||||||
|
|
||||||
function a: b; forward;
|
|
||||||
function a(b: c): d; forward;
|
|
||||||
function a(b, c: d; e: f): g; forward;
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
(root
|
|
||||||
(declProc (kProcedure) (identifier) (kForward))
|
|
||||||
(declProc (kProcedure) (identifier)
|
|
||||||
(declArgs
|
|
||||||
(declArg (identifier) (type (typeref (identifier)))))
|
|
||||||
(kForward))
|
|
||||||
(declProc (kProcedure) (identifier)
|
|
||||||
(declArgs
|
|
||||||
(declArg (identifier) (identifier) (type (typeref (identifier))))
|
|
||||||
(declArg (identifier) (type (typeref (identifier)))))
|
|
||||||
(kForward))
|
|
||||||
|
|
||||||
(declProc (kFunction) (identifier) (typeref (identifier)) (kForward))
|
|
||||||
(declProc (kFunction) (identifier)
|
|
||||||
(declArgs
|
|
||||||
(declArg (identifier) (type (typeref (identifier)))))
|
|
||||||
(typeref (identifier))
|
|
||||||
(kForward))
|
|
||||||
(declProc (kFunction) (identifier)
|
|
||||||
(declArgs
|
|
||||||
(declArg (identifier) (identifier) (type (typeref (identifier))))
|
|
||||||
(declArg (identifier) (type (typeref (identifier)))))
|
|
||||||
(typeref (identifier))
|
|
||||||
(kForward)))
|
|
||||||
|
|
||||||
|
|
||||||
===
|
|
||||||
Structures
|
|
||||||
===
|
|
||||||
|
|
||||||
type
|
|
||||||
a = class
|
|
||||||
end;
|
|
||||||
|
|
||||||
a = record
|
|
||||||
end;
|
|
||||||
|
|
||||||
a = object
|
|
||||||
end;
|
|
||||||
|
|
||||||
a = interface
|
|
||||||
end;
|
|
||||||
|
|
||||||
a = interface
|
|
||||||
['3d298d62-6d73-46a9-8267-24e4b3176cec']
|
|
||||||
end;
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
(root
|
|
||||||
(declTypes (kType)
|
|
||||||
(declType (identifier) (kEq) (declClass (kClass) (kEnd)))
|
|
||||||
(declType (identifier) (kEq) (declClass (kRecord) (kEnd)))
|
|
||||||
(declType (identifier) (kEq) (declClass (kObject) (kEnd)))
|
|
||||||
(declType (identifier) (kEq) (declIntf (kInterface) (kEnd)))
|
|
||||||
(declType (identifier) (kEq) (declIntf (kInterface) (guid (literalString)) (kEnd)))))
|
|
||||||
|
|
||||||
|
|
||||||
===
|
|
||||||
Inheritance
|
|
||||||
===
|
|
||||||
|
|
||||||
type
|
|
||||||
a = class(a,b)
|
|
||||||
end;
|
|
||||||
|
|
||||||
a = interface(a,b)
|
|
||||||
end;
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
(root
|
|
||||||
(declTypes (kType)
|
|
||||||
(declType (identifier) (kEq)
|
|
||||||
(declClass (kClass)
|
|
||||||
(typeref (identifier))
|
|
||||||
(typeref (identifier))
|
|
||||||
(kEnd)))
|
|
||||||
(declType (identifier) (kEq)
|
|
||||||
(declIntf (kInterface)
|
|
||||||
(typeref (identifier))
|
|
||||||
(typeref (identifier))
|
|
||||||
(kEnd)))))
|
|
||||||
===
|
|
||||||
Members
|
|
||||||
===
|
|
||||||
|
|
||||||
type
|
|
||||||
a = class
|
|
||||||
b, c: d;
|
|
||||||
e: f;
|
|
||||||
constructor d;
|
|
||||||
destructor e;
|
|
||||||
procedure f;
|
|
||||||
function g: h;
|
|
||||||
end;
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
(root
|
|
||||||
(declTypes (kType)
|
|
||||||
(declType (identifier) (kEq)
|
|
||||||
(declClass (kClass)
|
|
||||||
(declField (identifier) (identifier) (type (typeref (identifier))))
|
|
||||||
(declField (identifier) (type (typeref (identifier))))
|
|
||||||
(declProc (kConstructor) (identifier))
|
|
||||||
(declProc (kDestructor) (identifier))
|
|
||||||
(declProc (kProcedure) (identifier))
|
|
||||||
(declProc (kFunction) (identifier) (typeref (identifier)))
|
|
||||||
(kEnd)))))
|
|
||||||
|
|
||||||
===
|
|
||||||
Visibility
|
|
||||||
===
|
|
||||||
|
|
||||||
type
|
|
||||||
a = class
|
|
||||||
c: d;
|
|
||||||
procedure e;
|
|
||||||
private
|
|
||||||
f: g;
|
|
||||||
procedure h;
|
|
||||||
protected
|
|
||||||
i: j;
|
|
||||||
procedure k;
|
|
||||||
public
|
|
||||||
l: m;
|
|
||||||
procedure n;
|
|
||||||
published
|
|
||||||
o: p;
|
|
||||||
procedure q;
|
|
||||||
end;
|
|
||||||
|
|
||||||
a = class
|
|
||||||
strict private
|
|
||||||
private
|
|
||||||
strict protected
|
|
||||||
protected
|
|
||||||
public
|
|
||||||
published
|
|
||||||
end;
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
(root
|
|
||||||
(declTypes
|
|
||||||
(kType)
|
|
||||||
(declType (identifier) (kEq)
|
|
||||||
(declClass (kClass)
|
|
||||||
(declField (identifier) (type (typeref (identifier))))
|
|
||||||
(declProc (kProcedure) (identifier))
|
|
||||||
(declSection (kPrivate)
|
|
||||||
(declField (identifier) (type (typeref (identifier))))
|
|
||||||
(declProc (kProcedure) (identifier)))
|
|
||||||
(declSection (kProtected)
|
|
||||||
(declField (identifier) (type (typeref (identifier))))
|
|
||||||
(declProc (kProcedure) (identifier)))
|
|
||||||
(declSection (kPublic)
|
|
||||||
(declField (identifier) (type (typeref (identifier))))
|
|
||||||
(declProc (kProcedure) (identifier)))
|
|
||||||
(declSection (kPublished)
|
|
||||||
(declField (identifier) (type (typeref (identifier))))
|
|
||||||
(declProc (kProcedure) (identifier)))
|
|
||||||
(kEnd)))
|
|
||||||
(declType (identifier) (kEq)
|
|
||||||
(declClass (kClass)
|
|
||||||
(declSection (kStrict) (kPrivate))
|
|
||||||
(declSection (kPrivate))
|
|
||||||
(declSection (kStrict) (kProtected))
|
|
||||||
(declSection (kProtected))
|
|
||||||
(declSection (kPublic))
|
|
||||||
(declSection (kPublished))
|
|
||||||
(kEnd)))))
|
|
||||||
|
|
||||||
===
|
|
||||||
Nested declarations
|
|
||||||
===
|
|
||||||
|
|
||||||
type
|
|
||||||
a = class
|
|
||||||
type
|
|
||||||
b = class
|
|
||||||
end;
|
|
||||||
c = d;
|
|
||||||
var
|
|
||||||
e: f;
|
|
||||||
const
|
|
||||||
g = h;
|
|
||||||
public
|
|
||||||
constructor i;
|
|
||||||
end;
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
(root
|
|
||||||
(declTypes (kType)
|
|
||||||
(declType (identifier) (kEq)
|
|
||||||
(declClass (kClass)
|
|
||||||
(declTypes (kType)
|
|
||||||
(declType (identifier) (kEq)
|
|
||||||
(declClass
|
|
||||||
(kClass)
|
|
||||||
(kEnd)))
|
|
||||||
(declType (identifier) (kEq)
|
|
||||||
(type (typeref (identifier)))))
|
|
||||||
(declVars (kVar)
|
|
||||||
(declVar (identifier) (type (typeref (identifier)))))
|
|
||||||
(declConsts (kConst)
|
|
||||||
(declConst (identifier) (defaultValue (kEq) (identifier))))
|
|
||||||
(declSection (kPublic)
|
|
||||||
(declProc (kConstructor) (identifier)))
|
|
||||||
(kEnd)))))
|
|
||||||
|
|
||||||
===
|
|
||||||
Class members
|
|
||||||
===
|
|
||||||
|
|
||||||
type
|
|
||||||
a = class
|
|
||||||
class procedure b;
|
|
||||||
class var
|
|
||||||
c: d;
|
|
||||||
e: f;
|
|
||||||
end;
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
(root
|
|
||||||
(declTypes (kType)
|
|
||||||
(declType (identifier) (kEq)
|
|
||||||
(declClass (kClass)
|
|
||||||
(declProc (kClass) (kProcedure) (identifier))
|
|
||||||
(declVars (kClass) (kVar)
|
|
||||||
(declVar (identifier) (type (typeref (identifier))))
|
|
||||||
(declVar (identifier) (type (typeref (identifier)))))
|
|
||||||
(kEnd)))))
|
|
||||||
|
|
||||||
===
|
|
||||||
Properties
|
|
||||||
===
|
|
||||||
|
|
||||||
type
|
|
||||||
a = class
|
|
||||||
property b: c read d write f;
|
|
||||||
property b: c read d;
|
|
||||||
property b: c write d;
|
|
||||||
|
|
||||||
property b: c read d write f default g;
|
|
||||||
property b: c read d write f index g;
|
|
||||||
property b: c read d write f stored g;
|
|
||||||
|
|
||||||
property b[c, d: e; f: g]: h read i write j;
|
|
||||||
property b[c: d]: e read f write g; default;
|
|
||||||
end;
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
(root
|
|
||||||
(declTypes
|
|
||||||
(kType)
|
|
||||||
(declType (identifier) (kEq)
|
|
||||||
(declClass (kClass)
|
|
||||||
(declProp (kProperty) (identifier)
|
|
||||||
(type (typeref (identifier)))
|
|
||||||
(kRead) (identifier)
|
|
||||||
(kWrite) (identifier))
|
|
||||||
(declProp (kProperty) (identifier)
|
|
||||||
(type (typeref (identifier)))
|
|
||||||
(kRead) (identifier))
|
|
||||||
(declProp (kProperty) (identifier)
|
|
||||||
(type (typeref (identifier)))
|
|
||||||
(kWrite) (identifier))
|
|
||||||
(declProp (kProperty) (identifier)
|
|
||||||
(type (typeref (identifier)))
|
|
||||||
(kRead) (identifier)
|
|
||||||
(kWrite) (identifier)
|
|
||||||
(kDefault) (identifier))
|
|
||||||
(declProp (kProperty) (identifier)
|
|
||||||
(type (typeref (identifier)))
|
|
||||||
(kRead) (identifier)
|
|
||||||
(kWrite) (identifier)
|
|
||||||
(kIndex) (identifier))
|
|
||||||
(declProp (kProperty) (identifier)
|
|
||||||
(type (typeref (identifier)))
|
|
||||||
(kRead) (identifier)
|
|
||||||
(kWrite) (identifier)
|
|
||||||
(kStored) (identifier))
|
|
||||||
(declProp (kProperty) (identifier)
|
|
||||||
(declPropArgs
|
|
||||||
(declArg (identifier) (identifier) (type (typeref (identifier))))
|
|
||||||
(declArg (identifier) (type (typeref (identifier)))))
|
|
||||||
(type (typeref (identifier)))
|
|
||||||
(kRead) (identifier)
|
|
||||||
(kWrite) (identifier))
|
|
||||||
(declProp (kProperty) (identifier)
|
|
||||||
(declPropArgs
|
|
||||||
(declArg (identifier) (type (typeref (identifier)))))
|
|
||||||
(type (typeref (identifier)))
|
|
||||||
(kRead) (identifier)
|
|
||||||
(kWrite) (identifier)
|
|
||||||
(procAttribute (kDefault)))
|
|
||||||
(kEnd)))))
|
|
||||||
|
|
||||||
===
|
|
||||||
Variant Records
|
|
||||||
===
|
|
||||||
|
|
||||||
type
|
|
||||||
a = record
|
|
||||||
b: c;
|
|
||||||
case d of
|
|
||||||
0: (e: f);
|
|
||||||
1: (g, h: i; j: k);
|
|
||||||
end;
|
|
||||||
|
|
||||||
a = record
|
|
||||||
b: c;
|
|
||||||
case d: e of
|
|
||||||
0: (f: g);
|
|
||||||
1: (h: i);
|
|
||||||
end;
|
|
||||||
|
|
||||||
a = record
|
|
||||||
b: c;
|
|
||||||
case d of
|
|
||||||
0: (e: f;
|
|
||||||
case g of
|
|
||||||
0: (h: i);
|
|
||||||
1: (j: k);
|
|
||||||
);
|
|
||||||
1: (case l of
|
|
||||||
0: (m: n);
|
|
||||||
1: (o: p);
|
|
||||||
);
|
|
||||||
end;
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
(root
|
|
||||||
(declTypes (kType)
|
|
||||||
(declType (identifier) (kEq)
|
|
||||||
(declClass (kRecord)
|
|
||||||
(declField (identifier) (type (typeref (identifier))))
|
|
||||||
(declVariant (kCase) (typeref (identifier)) (kOf)
|
|
||||||
(declVariantClause
|
|
||||||
(caseLabel
|
|
||||||
(literalNumber))
|
|
||||||
(declField
|
|
||||||
(identifier)
|
|
||||||
(type (typeref (identifier)))))
|
|
||||||
(declVariantClause
|
|
||||||
(caseLabel
|
|
||||||
(literalNumber))
|
|
||||||
(declField
|
|
||||||
(identifier)
|
|
||||||
(identifier)
|
|
||||||
(type (typeref (identifier))))
|
|
||||||
(declField
|
|
||||||
(identifier)
|
|
||||||
(type (typeref (identifier))))))
|
|
||||||
(kEnd)))
|
|
||||||
(declType (identifier) (kEq)
|
|
||||||
(declClass (kRecord)
|
|
||||||
(declField (identifier) (type (typeref (identifier))))
|
|
||||||
(declVariant (kCase) (identifier) (typeref (identifier)) (kOf)
|
|
||||||
(declVariantClause
|
|
||||||
(caseLabel
|
|
||||||
(literalNumber))
|
|
||||||
(declField
|
|
||||||
(identifier)
|
|
||||||
(type (typeref (identifier)))))
|
|
||||||
(declVariantClause
|
|
||||||
(caseLabel
|
|
||||||
(literalNumber))
|
|
||||||
(declField
|
|
||||||
(identifier)
|
|
||||||
(type (typeref (identifier))))))
|
|
||||||
(kEnd)))
|
|
||||||
(declType (identifier) (kEq)
|
|
||||||
(declClass (kRecord)
|
|
||||||
(declField (identifier) (type (typeref (identifier))))
|
|
||||||
(declVariant (kCase) (typeref (identifier)) (kOf)
|
|
||||||
(declVariantClause
|
|
||||||
(caseLabel
|
|
||||||
(literalNumber))
|
|
||||||
(declField
|
|
||||||
(identifier)
|
|
||||||
(type (typeref (identifier))))
|
|
||||||
(declVariant (kCase) (typeref (identifier)) (kOf)
|
|
||||||
(declVariantClause
|
|
||||||
(caseLabel
|
|
||||||
(literalNumber))
|
|
||||||
(declField
|
|
||||||
(identifier)
|
|
||||||
(type (typeref (identifier)))))
|
|
||||||
(declVariantClause
|
|
||||||
(caseLabel
|
|
||||||
(literalNumber))
|
|
||||||
(declField
|
|
||||||
(identifier)
|
|
||||||
(type (typeref (identifier)))))))
|
|
||||||
(declVariantClause
|
|
||||||
(caseLabel
|
|
||||||
(literalNumber))
|
|
||||||
(declVariant (kCase) (typeref (identifier)) (kOf)
|
|
||||||
(declVariantClause
|
|
||||||
(caseLabel
|
|
||||||
(literalNumber))
|
|
||||||
(declField
|
|
||||||
(identifier)
|
|
||||||
(type (typeref (identifier)))))
|
|
||||||
(declVariantClause
|
|
||||||
(caseLabel
|
|
||||||
(literalNumber))
|
|
||||||
(declField
|
|
||||||
(identifier)
|
|
||||||
(type (typeref (identifier))))))))
|
|
||||||
(kEnd)))))
|
|
||||||
|
|
||||||
===
|
|
||||||
Operator overloads
|
|
||||||
===
|
|
||||||
|
|
||||||
type
|
|
||||||
a = record
|
|
||||||
operator +(b, c: a): a;
|
|
||||||
operator Subtract(b, c: a): a;
|
|
||||||
end;
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
(root
|
|
||||||
(declTypes (kType)
|
|
||||||
(declType (identifier) (kEq)
|
|
||||||
(declClass (kRecord)
|
|
||||||
(declProc (kOperator) (operatorName (kAdd))
|
|
||||||
(declArgs
|
|
||||||
(declArg
|
|
||||||
(identifier)
|
|
||||||
(identifier)
|
|
||||||
(type (typeref (identifier)))))
|
|
||||||
(type (typeref (identifier))))
|
|
||||||
(declProc (kOperator) (identifier)
|
|
||||||
(declArgs
|
|
||||||
(declArg
|
|
||||||
(identifier)
|
|
||||||
(identifier)
|
|
||||||
(type (typeref (identifier)))))
|
|
||||||
(type (typeref (identifier))))
|
|
||||||
(kEnd)))))
|
|
||||||
|
|
||||||
===
|
|
||||||
Inline type declarations
|
|
||||||
===
|
|
||||||
|
|
||||||
var
|
|
||||||
a: array of b;
|
|
||||||
a: string[b];
|
|
||||||
a: file of b;
|
|
||||||
a: file;
|
|
||||||
a: set of b;
|
|
||||||
a: set of (b, c);
|
|
||||||
|
|
||||||
procedure a(b: array of c; d: array of const; var e: string[4]);
|
|
||||||
begin
|
|
||||||
end;
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
(root
|
|
||||||
(declVars (kVar)
|
|
||||||
(declVar
|
|
||||||
(identifier)
|
|
||||||
(type (declArray (kArray) (kOf) (type (typeref (identifier))))))
|
|
||||||
(declVar
|
|
||||||
(identifier)
|
|
||||||
(type (declString (kString) (identifier))))
|
|
||||||
(declVar
|
|
||||||
(identifier)
|
|
||||||
(type (declFile (kFile) (kOf) (type (typeref (identifier))))))
|
|
||||||
(declVar
|
|
||||||
(identifier)
|
|
||||||
(type (declFile (kFile))))
|
|
||||||
(declVar
|
|
||||||
(identifier)
|
|
||||||
(type (declSet (kSet) (kOf) (type (typeref (identifier))))))
|
|
||||||
(declVar
|
|
||||||
(identifier)
|
|
||||||
(type
|
|
||||||
(declSet
|
|
||||||
(kSet)
|
|
||||||
(kOf)
|
|
||||||
(type
|
|
||||||
(declEnum
|
|
||||||
(declEnumValue
|
|
||||||
(identifier))
|
|
||||||
(declEnumValue
|
|
||||||
(identifier))))))))
|
|
||||||
(defProc
|
|
||||||
(declProc (kProcedure) (identifier)
|
|
||||||
(declArgs
|
|
||||||
(declArg
|
|
||||||
(identifier)
|
|
||||||
(type (declArray (kArray) (kOf) (type (typeref (identifier))))))
|
|
||||||
(declArg
|
|
||||||
(identifier)
|
|
||||||
(type (declArray (kArray) (kOf) (type (typeref (identifier))))))
|
|
||||||
(declArg
|
|
||||||
(kVar)
|
|
||||||
(identifier)
|
|
||||||
(type (declString (kString) (literalNumber))))))
|
|
||||||
(block
|
|
||||||
(kBegin)
|
|
||||||
(kEnd))))
|
|
||||||
@ -1,314 +0,0 @@
|
|||||||
===
|
|
||||||
Comparison
|
|
||||||
===
|
|
||||||
|
|
||||||
procedure Main;
|
|
||||||
begin
|
|
||||||
a = b = c;
|
|
||||||
a <> b <> c;
|
|
||||||
a < b < c;
|
|
||||||
a > b > c;
|
|
||||||
a <= b <= b;
|
|
||||||
a >= b >= b;
|
|
||||||
end;
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
(root
|
|
||||||
(defProc
|
|
||||||
(declProc (kProcedure) (identifier))
|
|
||||||
(block
|
|
||||||
(kBegin)
|
|
||||||
(statement (exprBinary (exprBinary (identifier) (kEq) (identifier)) (kEq) (identifier)))
|
|
||||||
(statement (exprBinary (exprBinary (identifier) (kNeq) (identifier)) (kNeq) (identifier)))
|
|
||||||
(statement (exprBinary (identifier) (kLt) (exprBinary (identifier) (kLt) (identifier))))
|
|
||||||
(statement (exprBinary (exprBinary (identifier) (kGt) (identifier)) (kGt) (identifier)))
|
|
||||||
(statement (exprBinary (exprBinary (identifier) (kLte) (identifier)) (kLte) (identifier)))
|
|
||||||
(statement (exprBinary (exprBinary (identifier) (kGte) (identifier)) (kGte) (identifier)))
|
|
||||||
(kEnd))))
|
|
||||||
|
|
||||||
|
|
||||||
===
|
|
||||||
Arithmetic
|
|
||||||
===
|
|
||||||
|
|
||||||
procedure Main;
|
|
||||||
begin
|
|
||||||
a + b + c;
|
|
||||||
a - b - c;
|
|
||||||
a * b * c;
|
|
||||||
a / b / c;
|
|
||||||
a div b div c;
|
|
||||||
a mod b mod c;
|
|
||||||
|
|
||||||
++a;
|
|
||||||
--a;
|
|
||||||
end;
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
(root
|
|
||||||
(defProc
|
|
||||||
(declProc (kProcedure) (identifier))
|
|
||||||
(block
|
|
||||||
(kBegin)
|
|
||||||
(statement (exprBinary (exprBinary (identifier) (kAdd) (identifier)) (kAdd) (identifier)))
|
|
||||||
(statement (exprBinary (exprBinary (identifier) (kSub) (identifier)) (kSub) (identifier)))
|
|
||||||
(statement (exprBinary (exprBinary (identifier) (kMul) (identifier)) (kMul) (identifier)))
|
|
||||||
(statement (exprBinary (exprBinary (identifier) (kFdiv) (identifier)) (kFdiv) (identifier)))
|
|
||||||
(statement (exprBinary (exprBinary (identifier) (kDiv) (identifier)) (kDiv) (identifier)))
|
|
||||||
(statement (exprBinary (exprBinary (identifier) (kMod) (identifier)) (kMod) (identifier)))
|
|
||||||
(statement (exprUnary (kAdd) (exprUnary (kAdd) (identifier))))
|
|
||||||
(statement (exprUnary (kSub) (exprUnary (kSub) (identifier))))
|
|
||||||
(kEnd))))
|
|
||||||
|
|
||||||
|
|
||||||
===
|
|
||||||
Logical
|
|
||||||
===
|
|
||||||
|
|
||||||
procedure Main;
|
|
||||||
begin
|
|
||||||
a or b or c;
|
|
||||||
a xor b xor c;
|
|
||||||
a and b and c;
|
|
||||||
|
|
||||||
a shl b shl c;
|
|
||||||
a shr b shr c;
|
|
||||||
|
|
||||||
not not a;
|
|
||||||
end;
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
(root
|
|
||||||
(defProc
|
|
||||||
(declProc (kProcedure) (identifier))
|
|
||||||
(block
|
|
||||||
(kBegin)
|
|
||||||
(statement (exprBinary (exprBinary (identifier) (kOr) (identifier)) (kOr) (identifier)))
|
|
||||||
(statement (exprBinary (exprBinary (identifier) (kXor) (identifier)) (kXor) (identifier)))
|
|
||||||
(statement (exprBinary (exprBinary (identifier) (kAnd) (identifier)) (kAnd) (identifier)))
|
|
||||||
(statement (exprBinary (exprBinary (identifier) (kShl) (identifier)) (kShl) (identifier)))
|
|
||||||
(statement (exprBinary (exprBinary (identifier) (kShr) (identifier)) (kShr) (identifier)))
|
|
||||||
(statement (exprUnary (kNot) (exprUnary (kNot) (identifier))))
|
|
||||||
(kEnd))))
|
|
||||||
|
|
||||||
|
|
||||||
===
|
|
||||||
Other
|
|
||||||
===
|
|
||||||
|
|
||||||
procedure Main;
|
|
||||||
begin
|
|
||||||
a in b;
|
|
||||||
a is b;
|
|
||||||
a as b;
|
|
||||||
|
|
||||||
@@a;
|
|
||||||
a^^;
|
|
||||||
end;
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
(root
|
|
||||||
(defProc
|
|
||||||
(declProc (kProcedure) (identifier))
|
|
||||||
(block
|
|
||||||
(kBegin)
|
|
||||||
(statement (exprBinary (identifier) (kIn) (identifier)))
|
|
||||||
(statement (exprBinary (identifier) (kIs) (identifier)))
|
|
||||||
(statement (exprBinary (identifier) (kAs) (identifier)))
|
|
||||||
(statement (exprUnary (kAt) (exprUnary (kAt) (identifier))))
|
|
||||||
(statement (exprUnary (exprUnary (identifier) (kHat)) (kHat)))
|
|
||||||
(kEnd))))
|
|
||||||
|
|
||||||
===
|
|
||||||
Parentheses
|
|
||||||
===
|
|
||||||
|
|
||||||
procedure Main;
|
|
||||||
begin
|
|
||||||
(a);
|
|
||||||
end;
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
(root
|
|
||||||
(defProc
|
|
||||||
(declProc (kProcedure) (identifier))
|
|
||||||
(block
|
|
||||||
(kBegin)
|
|
||||||
(statement (exprParens (identifier)))
|
|
||||||
(kEnd))))
|
|
||||||
|
|
||||||
===
|
|
||||||
Brackets/Sets
|
|
||||||
===
|
|
||||||
|
|
||||||
procedure Main;
|
|
||||||
begin
|
|
||||||
[a];
|
|
||||||
[a,b];
|
|
||||||
[a..b];
|
|
||||||
[a..b,c];
|
|
||||||
end;
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
(root
|
|
||||||
(defProc
|
|
||||||
(declProc (kProcedure) (identifier))
|
|
||||||
(block
|
|
||||||
(kBegin)
|
|
||||||
(statement (exprBrackets (identifier)))
|
|
||||||
(statement (exprBrackets (identifier) (identifier)))
|
|
||||||
(statement (exprBrackets (range (identifier) (identifier))))
|
|
||||||
(statement (exprBrackets (range (identifier) (identifier)) (identifier)))
|
|
||||||
(kEnd))))
|
|
||||||
|
|
||||||
===
|
|
||||||
Calls
|
|
||||||
===
|
|
||||||
|
|
||||||
procedure Main;
|
|
||||||
begin
|
|
||||||
a(b);
|
|
||||||
a(b,c);
|
|
||||||
a(b)(c);
|
|
||||||
end;
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
(root
|
|
||||||
(defProc
|
|
||||||
(declProc (kProcedure) (identifier))
|
|
||||||
(block
|
|
||||||
(kBegin)
|
|
||||||
(statement (exprCall (identifier) (exprArgs (identifier))))
|
|
||||||
(statement (exprCall (identifier) (exprArgs (identifier) (identifier))))
|
|
||||||
(statement
|
|
||||||
(exprCall
|
|
||||||
(exprCall (identifier) (exprArgs (identifier)))
|
|
||||||
(exprArgs (identifier))))
|
|
||||||
(kEnd))))
|
|
||||||
|
|
||||||
===
|
|
||||||
Subscripts
|
|
||||||
===
|
|
||||||
|
|
||||||
procedure Main;
|
|
||||||
begin
|
|
||||||
a[b];
|
|
||||||
a[b,c];
|
|
||||||
a[b][c];
|
|
||||||
end;
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
(root
|
|
||||||
(defProc
|
|
||||||
(declProc (kProcedure) (identifier))
|
|
||||||
(block
|
|
||||||
(kBegin)
|
|
||||||
(statement (exprSubscript (identifier) (exprArgs (identifier))))
|
|
||||||
(statement (exprSubscript (identifier) (exprArgs (identifier) (identifier))))
|
|
||||||
(statement
|
|
||||||
(exprSubscript
|
|
||||||
(exprSubscript
|
|
||||||
(identifier)
|
|
||||||
(exprArgs
|
|
||||||
(identifier)))
|
|
||||||
(exprArgs
|
|
||||||
(identifier))))
|
|
||||||
(kEnd))))
|
|
||||||
|
|
||||||
===
|
|
||||||
Precedence
|
|
||||||
===
|
|
||||||
|
|
||||||
procedure Main;
|
|
||||||
begin
|
|
||||||
not (a or b and c) and d;
|
|
||||||
- (a + b * c) * d;
|
|
||||||
a = b or c = d;
|
|
||||||
@a.b;
|
|
||||||
a.b^;
|
|
||||||
a.b(c);
|
|
||||||
end;
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
(root
|
|
||||||
(defProc
|
|
||||||
(declProc (kProcedure) (identifier))
|
|
||||||
(block
|
|
||||||
(kBegin)
|
|
||||||
(statement
|
|
||||||
(exprBinary
|
|
||||||
(exprUnary
|
|
||||||
(kNot)
|
|
||||||
(exprParens
|
|
||||||
(exprBinary
|
|
||||||
(identifier)
|
|
||||||
(kOr)
|
|
||||||
(exprBinary
|
|
||||||
(identifier)
|
|
||||||
(kAnd)
|
|
||||||
(identifier)))))
|
|
||||||
(kAnd)
|
|
||||||
(identifier)))
|
|
||||||
|
|
||||||
(statement
|
|
||||||
(exprBinary
|
|
||||||
(exprUnary
|
|
||||||
(kSub)
|
|
||||||
(exprParens
|
|
||||||
(exprBinary
|
|
||||||
(identifier)
|
|
||||||
(kAdd)
|
|
||||||
(exprBinary
|
|
||||||
(identifier)
|
|
||||||
(kMul)
|
|
||||||
(identifier)))))
|
|
||||||
(kMul)
|
|
||||||
(identifier)))
|
|
||||||
|
|
||||||
(statement
|
|
||||||
(exprBinary
|
|
||||||
(exprBinary
|
|
||||||
(identifier)
|
|
||||||
(kEq)
|
|
||||||
(exprBinary
|
|
||||||
(identifier)
|
|
||||||
(kOr)
|
|
||||||
(identifier)))
|
|
||||||
(kEq)
|
|
||||||
(identifier)))
|
|
||||||
|
|
||||||
(statement
|
|
||||||
(exprUnary
|
|
||||||
(kAt)
|
|
||||||
(exprDot
|
|
||||||
(identifier)
|
|
||||||
(kDot)
|
|
||||||
(identifier))))
|
|
||||||
|
|
||||||
(statement
|
|
||||||
(exprUnary
|
|
||||||
(exprDot
|
|
||||||
(identifier)
|
|
||||||
(kDot)
|
|
||||||
(identifier))
|
|
||||||
(kHat)))
|
|
||||||
|
|
||||||
(statement
|
|
||||||
(exprCall
|
|
||||||
(exprDot
|
|
||||||
(identifier)
|
|
||||||
(kDot)
|
|
||||||
(identifier))
|
|
||||||
(exprArgs
|
|
||||||
(identifier))))
|
|
||||||
|
|
||||||
(kEnd))))
|
|
||||||
@ -1,265 +0,0 @@
|
|||||||
===
|
|
||||||
Generic Type Declaration
|
|
||||||
===
|
|
||||||
|
|
||||||
type
|
|
||||||
a<b> = x;
|
|
||||||
a<b: constraint> = x;
|
|
||||||
a<b,c> = x;
|
|
||||||
a<b,c: constraint> = x;
|
|
||||||
a<b; c: constraint> = x;
|
|
||||||
a<b, c: constraint; d,e: constraint> = x;
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
(root
|
|
||||||
(declTypes (kType)
|
|
||||||
(declType
|
|
||||||
(genericTpl
|
|
||||||
(identifier)
|
|
||||||
(kLt)
|
|
||||||
(genericArgs
|
|
||||||
(genericArg
|
|
||||||
(identifier)))
|
|
||||||
(kGt))
|
|
||||||
(kEq)
|
|
||||||
(type (typeref (identifier))))
|
|
||||||
(declType
|
|
||||||
(genericTpl
|
|
||||||
(identifier)
|
|
||||||
(kLt)
|
|
||||||
(genericArgs
|
|
||||||
(genericArg
|
|
||||||
(identifier) (typeref (identifier))))
|
|
||||||
(kGt))
|
|
||||||
(kEq)
|
|
||||||
(type (typeref (identifier))))
|
|
||||||
(declType
|
|
||||||
(genericTpl
|
|
||||||
(identifier)
|
|
||||||
(kLt)
|
|
||||||
(genericArgs
|
|
||||||
(genericArg (identifier) (identifier)))
|
|
||||||
(kGt))
|
|
||||||
(kEq)
|
|
||||||
(type (typeref (identifier))))
|
|
||||||
(declType
|
|
||||||
(genericTpl
|
|
||||||
(identifier)
|
|
||||||
(kLt)
|
|
||||||
(genericArgs
|
|
||||||
(genericArg (identifier) (identifier) (typeref (identifier))))
|
|
||||||
(kGt))
|
|
||||||
(kEq)
|
|
||||||
(type (typeref (identifier))))
|
|
||||||
(declType
|
|
||||||
(genericTpl
|
|
||||||
(identifier)
|
|
||||||
(kLt)
|
|
||||||
(genericArgs
|
|
||||||
(genericArg (identifier))
|
|
||||||
(genericArg (identifier) (typeref (identifier))))
|
|
||||||
(kGt))
|
|
||||||
(kEq)
|
|
||||||
(type (typeref (identifier))))
|
|
||||||
(declType
|
|
||||||
(genericTpl
|
|
||||||
(identifier)
|
|
||||||
(kLt)
|
|
||||||
(genericArgs
|
|
||||||
(genericArg (identifier) (identifier) (typeref (identifier)))
|
|
||||||
(genericArg (identifier) (identifier) (typeref (identifier))))
|
|
||||||
(kGt))
|
|
||||||
(kEq)
|
|
||||||
(type (typeref (identifier))))))
|
|
||||||
|
|
||||||
===
|
|
||||||
Generic Specialization
|
|
||||||
===
|
|
||||||
|
|
||||||
type
|
|
||||||
a = b<c>;
|
|
||||||
a = b<c,d>;
|
|
||||||
a = b<c, d<e, f> >;
|
|
||||||
|
|
||||||
var
|
|
||||||
a: b<c>;
|
|
||||||
a: b<c,d>;
|
|
||||||
a: b<c, d<e, f> >;
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
(root
|
|
||||||
(declTypes (kType)
|
|
||||||
(declType (identifier) (kEq)
|
|
||||||
(type
|
|
||||||
(typeref
|
|
||||||
(typerefTpl
|
|
||||||
(identifier)
|
|
||||||
(kLt)
|
|
||||||
(typerefArgs
|
|
||||||
(identifier))
|
|
||||||
(kGt)))))
|
|
||||||
(declType (identifier) (kEq)
|
|
||||||
(type
|
|
||||||
(typeref
|
|
||||||
(typerefTpl
|
|
||||||
(identifier)
|
|
||||||
(kLt)
|
|
||||||
(typerefArgs
|
|
||||||
(identifier)
|
|
||||||
(identifier))
|
|
||||||
(kGt)))))
|
|
||||||
(declType (identifier) (kEq)
|
|
||||||
(type
|
|
||||||
(typeref
|
|
||||||
(typerefTpl
|
|
||||||
(identifier)
|
|
||||||
(kLt)
|
|
||||||
(typerefArgs
|
|
||||||
(identifier)
|
|
||||||
(typerefTpl
|
|
||||||
(identifier)
|
|
||||||
(kLt)
|
|
||||||
(typerefArgs
|
|
||||||
(identifier)
|
|
||||||
(identifier))
|
|
||||||
(kGt)))
|
|
||||||
(kGt))))))
|
|
||||||
(declVars (kVar)
|
|
||||||
(declVar
|
|
||||||
(identifier)
|
|
||||||
(type
|
|
||||||
(typeref
|
|
||||||
(typerefTpl
|
|
||||||
(identifier)
|
|
||||||
(kLt)
|
|
||||||
(typerefArgs
|
|
||||||
(identifier))
|
|
||||||
(kGt)))))
|
|
||||||
(declVar
|
|
||||||
(identifier)
|
|
||||||
(type
|
|
||||||
(typeref
|
|
||||||
(typerefTpl
|
|
||||||
(identifier)
|
|
||||||
(kLt)
|
|
||||||
(typerefArgs
|
|
||||||
(identifier)
|
|
||||||
(identifier))
|
|
||||||
(kGt)))))
|
|
||||||
(declVar
|
|
||||||
(identifier)
|
|
||||||
(type
|
|
||||||
(typeref
|
|
||||||
(typerefTpl
|
|
||||||
(identifier)
|
|
||||||
(kLt)
|
|
||||||
(typerefArgs
|
|
||||||
(identifier)
|
|
||||||
(typerefTpl
|
|
||||||
(identifier)
|
|
||||||
(kLt)
|
|
||||||
(typerefArgs
|
|
||||||
(identifier)
|
|
||||||
(identifier))
|
|
||||||
(kGt)))
|
|
||||||
(kGt)))))))
|
|
||||||
|
|
||||||
|
|
||||||
===
|
|
||||||
Generic Routines
|
|
||||||
===
|
|
||||||
|
|
||||||
procedure a<b>(c: b); forward;
|
|
||||||
|
|
||||||
procedure a<b,c>.d<e>.Main<f>;
|
|
||||||
begin
|
|
||||||
end;
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
(root
|
|
||||||
(declProc (kProcedure)
|
|
||||||
(genericTpl
|
|
||||||
(identifier)
|
|
||||||
(kLt)
|
|
||||||
(genericArgs
|
|
||||||
(genericArg
|
|
||||||
(identifier)))
|
|
||||||
(kGt))
|
|
||||||
(declArgs
|
|
||||||
(declArg
|
|
||||||
(identifier)
|
|
||||||
(type (typeref (identifier)))))
|
|
||||||
(kForward))
|
|
||||||
(defProc
|
|
||||||
(declProc (kProcedure)
|
|
||||||
(genericDot
|
|
||||||
(genericDot
|
|
||||||
(genericTpl
|
|
||||||
(identifier)
|
|
||||||
(kLt)
|
|
||||||
(genericArgs
|
|
||||||
(genericArg
|
|
||||||
(identifier)
|
|
||||||
(identifier)))
|
|
||||||
(kGt))
|
|
||||||
(kDot)
|
|
||||||
(genericTpl
|
|
||||||
(identifier)
|
|
||||||
(kLt)
|
|
||||||
(genericArgs
|
|
||||||
(genericArg
|
|
||||||
(identifier)))
|
|
||||||
(kGt)))
|
|
||||||
(kDot)
|
|
||||||
(genericTpl
|
|
||||||
(identifier)
|
|
||||||
(kLt)
|
|
||||||
(genericArgs
|
|
||||||
(genericArg
|
|
||||||
(identifier)))
|
|
||||||
(kGt))))
|
|
||||||
(block
|
|
||||||
(kBegin)
|
|
||||||
(kEnd))))
|
|
||||||
|
|
||||||
|
|
||||||
===
|
|
||||||
Generic Expressions
|
|
||||||
===
|
|
||||||
|
|
||||||
procedure a;
|
|
||||||
begin
|
|
||||||
if b<c>(d) < e<f,g> then
|
|
||||||
;
|
|
||||||
end;
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
(root
|
|
||||||
(defProc
|
|
||||||
(declProc (kProcedure) (identifier))
|
|
||||||
(block
|
|
||||||
(kBegin)
|
|
||||||
(if
|
|
||||||
(kIf)
|
|
||||||
(exprBinary
|
|
||||||
(exprCall
|
|
||||||
(exprTpl
|
|
||||||
(identifier)
|
|
||||||
(kLt)
|
|
||||||
(identifier)
|
|
||||||
(kGt))
|
|
||||||
(exprArgs
|
|
||||||
(identifier)))
|
|
||||||
(kLt)
|
|
||||||
(exprTpl
|
|
||||||
(identifier)
|
|
||||||
(kLt)
|
|
||||||
(identifier)
|
|
||||||
(identifier)
|
|
||||||
(kGt)))
|
|
||||||
(kThen))
|
|
||||||
(kEnd))))
|
|
||||||
@ -1,283 +0,0 @@
|
|||||||
===
|
|
||||||
Generic Type Declaration
|
|
||||||
===
|
|
||||||
|
|
||||||
type
|
|
||||||
generic a<b> = x;
|
|
||||||
generic a<b: constraint> = x;
|
|
||||||
generic a<b,c> = x;
|
|
||||||
generic a<b,c: constraint> = x;
|
|
||||||
generic a<b; c: constraint> = x;
|
|
||||||
generic a<b, c: constraint; d,e: constraint> = x;
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
(root
|
|
||||||
(declTypes (kType)
|
|
||||||
(declType (kGeneric)
|
|
||||||
(genericTpl
|
|
||||||
(identifier)
|
|
||||||
(kLt)
|
|
||||||
(genericArgs
|
|
||||||
(genericArg
|
|
||||||
(identifier)))
|
|
||||||
(kGt))
|
|
||||||
(kEq)
|
|
||||||
(type (typeref (identifier))))
|
|
||||||
(declType (kGeneric)
|
|
||||||
(genericTpl
|
|
||||||
(identifier)
|
|
||||||
(kLt)
|
|
||||||
(genericArgs
|
|
||||||
(genericArg
|
|
||||||
(identifier) (typeref (identifier))))
|
|
||||||
(kGt))
|
|
||||||
(kEq)
|
|
||||||
(type (typeref (identifier))))
|
|
||||||
(declType (kGeneric)
|
|
||||||
(genericTpl
|
|
||||||
(identifier)
|
|
||||||
(kLt)
|
|
||||||
(genericArgs
|
|
||||||
(genericArg (identifier) (identifier)))
|
|
||||||
(kGt))
|
|
||||||
(kEq)
|
|
||||||
(type (typeref (identifier))))
|
|
||||||
(declType (kGeneric)
|
|
||||||
(genericTpl
|
|
||||||
(identifier)
|
|
||||||
(kLt)
|
|
||||||
(genericArgs
|
|
||||||
(genericArg (identifier) (identifier) (typeref (identifier))))
|
|
||||||
(kGt))
|
|
||||||
(kEq)
|
|
||||||
(type (typeref (identifier))))
|
|
||||||
(declType (kGeneric)
|
|
||||||
(genericTpl
|
|
||||||
(identifier)
|
|
||||||
(kLt)
|
|
||||||
(genericArgs
|
|
||||||
(genericArg (identifier))
|
|
||||||
(genericArg (identifier) (typeref (identifier))))
|
|
||||||
(kGt))
|
|
||||||
(kEq)
|
|
||||||
(type (typeref (identifier))))
|
|
||||||
(declType (kGeneric)
|
|
||||||
(genericTpl
|
|
||||||
(identifier)
|
|
||||||
(kLt)
|
|
||||||
(genericArgs
|
|
||||||
(genericArg (identifier) (identifier) (typeref (identifier)))
|
|
||||||
(genericArg (identifier) (identifier) (typeref (identifier))))
|
|
||||||
(kGt))
|
|
||||||
(kEq)
|
|
||||||
(type (typeref (identifier))))))
|
|
||||||
|
|
||||||
===
|
|
||||||
Generic Specialization
|
|
||||||
===
|
|
||||||
|
|
||||||
type
|
|
||||||
a = specialize b<c>;
|
|
||||||
a = specialize b<c,d>;
|
|
||||||
a = specialize b<c, d<e, f> >;
|
|
||||||
|
|
||||||
var
|
|
||||||
a: specialize b<c>;
|
|
||||||
a: specialize b<c,d>;
|
|
||||||
a: specialize b<c, d<e, f> >;
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
(root
|
|
||||||
(declTypes (kType)
|
|
||||||
(declType (identifier) (kEq)
|
|
||||||
(type
|
|
||||||
(typeref (kSpecialize)
|
|
||||||
(typerefTpl
|
|
||||||
(identifier)
|
|
||||||
(kLt)
|
|
||||||
(typerefArgs
|
|
||||||
(identifier))
|
|
||||||
(kGt)))))
|
|
||||||
(declType (identifier) (kEq)
|
|
||||||
(type
|
|
||||||
(typeref (kSpecialize)
|
|
||||||
(typerefTpl
|
|
||||||
(identifier)
|
|
||||||
(kLt)
|
|
||||||
(typerefArgs
|
|
||||||
(identifier)
|
|
||||||
(identifier))
|
|
||||||
(kGt)))))
|
|
||||||
(declType (identifier) (kEq)
|
|
||||||
(type
|
|
||||||
(typeref (kSpecialize)
|
|
||||||
(typerefTpl
|
|
||||||
(identifier)
|
|
||||||
(kLt)
|
|
||||||
(typerefArgs
|
|
||||||
(identifier)
|
|
||||||
(typerefTpl
|
|
||||||
(identifier)
|
|
||||||
(kLt)
|
|
||||||
(typerefArgs
|
|
||||||
(identifier)
|
|
||||||
(identifier))
|
|
||||||
(kGt)))
|
|
||||||
(kGt))))))
|
|
||||||
(declVars (kVar)
|
|
||||||
(declVar
|
|
||||||
(identifier)
|
|
||||||
(type
|
|
||||||
(typeref (kSpecialize)
|
|
||||||
(typerefTpl
|
|
||||||
(identifier)
|
|
||||||
(kLt)
|
|
||||||
(typerefArgs
|
|
||||||
(identifier))
|
|
||||||
(kGt)))))
|
|
||||||
(declVar
|
|
||||||
(identifier)
|
|
||||||
(type
|
|
||||||
(typeref (kSpecialize)
|
|
||||||
(typerefTpl
|
|
||||||
(identifier)
|
|
||||||
(kLt)
|
|
||||||
(typerefArgs
|
|
||||||
(identifier)
|
|
||||||
(identifier))
|
|
||||||
(kGt)))))
|
|
||||||
(declVar
|
|
||||||
(identifier)
|
|
||||||
(type
|
|
||||||
(typeref (kSpecialize)
|
|
||||||
(typerefTpl
|
|
||||||
(identifier)
|
|
||||||
(kLt)
|
|
||||||
(typerefArgs
|
|
||||||
(identifier)
|
|
||||||
(typerefTpl
|
|
||||||
(identifier)
|
|
||||||
(kLt)
|
|
||||||
(typerefArgs
|
|
||||||
(identifier)
|
|
||||||
(identifier))
|
|
||||||
(kGt)))
|
|
||||||
(kGt)))))))
|
|
||||||
|
|
||||||
===
|
|
||||||
Generic Routines
|
|
||||||
===
|
|
||||||
|
|
||||||
generic procedure a<b>(c: b); forward;
|
|
||||||
|
|
||||||
generic procedure a<b,c>.d<e>.Main<f>;
|
|
||||||
begin
|
|
||||||
end;
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
(root
|
|
||||||
(declProc (kGeneric) (kProcedure)
|
|
||||||
(genericTpl
|
|
||||||
(identifier)
|
|
||||||
(kLt)
|
|
||||||
(genericArgs
|
|
||||||
(genericArg
|
|
||||||
(identifier)))
|
|
||||||
(kGt))
|
|
||||||
(declArgs
|
|
||||||
(declArg
|
|
||||||
(identifier)
|
|
||||||
(type (typeref (identifier)))))
|
|
||||||
(kForward))
|
|
||||||
(defProc
|
|
||||||
(declProc (kGeneric) (kProcedure)
|
|
||||||
(genericDot
|
|
||||||
(genericDot
|
|
||||||
(genericTpl
|
|
||||||
(identifier)
|
|
||||||
(kLt)
|
|
||||||
(genericArgs
|
|
||||||
(genericArg
|
|
||||||
(identifier)
|
|
||||||
(identifier)))
|
|
||||||
(kGt))
|
|
||||||
(kDot)
|
|
||||||
(genericTpl
|
|
||||||
(identifier)
|
|
||||||
(kLt)
|
|
||||||
(genericArgs
|
|
||||||
(genericArg
|
|
||||||
(identifier)))
|
|
||||||
(kGt)))
|
|
||||||
(kDot)
|
|
||||||
(genericTpl
|
|
||||||
(identifier)
|
|
||||||
(kLt)
|
|
||||||
(genericArgs
|
|
||||||
(genericArg
|
|
||||||
(identifier)))
|
|
||||||
(kGt))))
|
|
||||||
(block
|
|
||||||
(kBegin)
|
|
||||||
(kEnd))))
|
|
||||||
|
|
||||||
===
|
|
||||||
Generic Expressions
|
|
||||||
===
|
|
||||||
|
|
||||||
procedure a;
|
|
||||||
begin
|
|
||||||
if specialize b<c>(d) < specialize e<f,g> then
|
|
||||||
;
|
|
||||||
end;
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
(root
|
|
||||||
(defProc
|
|
||||||
(declProc (kProcedure) (identifier))
|
|
||||||
(block
|
|
||||||
(kBegin)
|
|
||||||
(if
|
|
||||||
(kIf)
|
|
||||||
(exprBinary
|
|
||||||
(exprCall
|
|
||||||
(exprTpl (kSpecialize)
|
|
||||||
(identifier)
|
|
||||||
(kLt)
|
|
||||||
(identifier)
|
|
||||||
(kGt))
|
|
||||||
(exprArgs
|
|
||||||
(identifier)))
|
|
||||||
(kLt)
|
|
||||||
(exprTpl (kSpecialize)
|
|
||||||
(identifier)
|
|
||||||
(kLt)
|
|
||||||
(identifier)
|
|
||||||
(identifier)
|
|
||||||
(kGt)))
|
|
||||||
(kThen))
|
|
||||||
(kEnd))))
|
|
||||||
|
|
||||||
===
|
|
||||||
"specialize" as an identifier
|
|
||||||
===
|
|
||||||
|
|
||||||
procedure specialize;
|
|
||||||
begin
|
|
||||||
specialize();
|
|
||||||
end;
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
(root
|
|
||||||
(defProc
|
|
||||||
(declProc (kProcedure) (identifier))
|
|
||||||
(block
|
|
||||||
(kBegin)
|
|
||||||
(statement (exprCall (identifier)))
|
|
||||||
(kEnd))))
|
|
||||||
|
|
||||||
@ -1,111 +0,0 @@
|
|||||||
===
|
|
||||||
Anonymous functions
|
|
||||||
===
|
|
||||||
|
|
||||||
procedure Main;
|
|
||||||
begin
|
|
||||||
a :=
|
|
||||||
procedure
|
|
||||||
begin
|
|
||||||
end;
|
|
||||||
|
|
||||||
b :=
|
|
||||||
function(a,b:c): d
|
|
||||||
begin
|
|
||||||
Result := 42;
|
|
||||||
end;
|
|
||||||
|
|
||||||
c :=
|
|
||||||
(
|
|
||||||
function(a:b): b
|
|
||||||
begin
|
|
||||||
Result := a;
|
|
||||||
end
|
|
||||||
)(42);
|
|
||||||
end;
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
(root
|
|
||||||
(defProc
|
|
||||||
(declProc (kProcedure) (identifier))
|
|
||||||
(block
|
|
||||||
(kBegin)
|
|
||||||
(assignment
|
|
||||||
(identifier)
|
|
||||||
(kAssign)
|
|
||||||
(lambda (kProcedure)
|
|
||||||
(block
|
|
||||||
(kBegin)
|
|
||||||
(kEnd))))
|
|
||||||
(assignment
|
|
||||||
(identifier)
|
|
||||||
(kAssign)
|
|
||||||
(lambda (kFunction)
|
|
||||||
(declArgs
|
|
||||||
(declArg
|
|
||||||
(identifier)
|
|
||||||
(identifier)
|
|
||||||
(type (typeref (identifier)))))
|
|
||||||
(typeref (identifier))
|
|
||||||
(block
|
|
||||||
(kBegin)
|
|
||||||
(assignment (identifier) (kAssign) (literalNumber))
|
|
||||||
(kEnd))))
|
|
||||||
(assignment
|
|
||||||
(identifier)
|
|
||||||
(kAssign)
|
|
||||||
(exprCall
|
|
||||||
(exprParens
|
|
||||||
(lambda (kFunction)
|
|
||||||
(declArgs
|
|
||||||
(declArg
|
|
||||||
(identifier)
|
|
||||||
(type (typeref (identifier)))))
|
|
||||||
(typeref (identifier))
|
|
||||||
(block
|
|
||||||
(kBegin)
|
|
||||||
(assignment (identifier) (kAssign) (identifier))
|
|
||||||
(kEnd))))
|
|
||||||
(exprArgs
|
|
||||||
(literalNumber))))
|
|
||||||
(kEnd))))
|
|
||||||
|
|
||||||
|
|
||||||
===
|
|
||||||
Reference to
|
|
||||||
===
|
|
||||||
|
|
||||||
type
|
|
||||||
a = reference to procedure;
|
|
||||||
a = reference to procedure(b, c: d);
|
|
||||||
a = reference to function: b;
|
|
||||||
a = reference to function(b: c): d;
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
(root
|
|
||||||
(declTypes (kType)
|
|
||||||
(declType (identifier) (kEq)
|
|
||||||
(type
|
|
||||||
(declProcRef (kReference) (kTo) (kProcedure))))
|
|
||||||
(declType (identifier) (kEq)
|
|
||||||
(type
|
|
||||||
(declProcRef (kReference) (kTo) (kProcedure)
|
|
||||||
(declArgs
|
|
||||||
(declArg
|
|
||||||
(identifier)
|
|
||||||
(identifier)
|
|
||||||
(type (typeref (identifier))))))))
|
|
||||||
(declType (identifier) (kEq)
|
|
||||||
(type
|
|
||||||
(declProcRef (kReference) (kTo) (kFunction)
|
|
||||||
(typeref (identifier)))))
|
|
||||||
(declType (identifier) (kEq)
|
|
||||||
(type
|
|
||||||
(declProcRef (kReference) (kTo) (kFunction)
|
|
||||||
(declArgs
|
|
||||||
(declArg (identifier)
|
|
||||||
(type (typeref (identifier)))))
|
|
||||||
(typeref (identifier)))))))
|
|
||||||
|
|
||||||
@ -1,176 +0,0 @@
|
|||||||
===
|
|
||||||
Integers
|
|
||||||
===
|
|
||||||
|
|
||||||
const
|
|
||||||
a = 1234567890;
|
|
||||||
b = +123;
|
|
||||||
c = -123;
|
|
||||||
d = $123abc;
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
(root
|
|
||||||
(declConsts (kConst)
|
|
||||||
(declConst (identifier) (defaultValue (kEq) (literalNumber)))
|
|
||||||
(declConst (identifier) (defaultValue (kEq) (literalNumber)))
|
|
||||||
(declConst (identifier) (defaultValue (kEq) (literalNumber)))
|
|
||||||
(declConst (identifier) (defaultValue (kEq) (literalNumber)))))
|
|
||||||
|
|
||||||
|
|
||||||
===
|
|
||||||
Floating point numbers
|
|
||||||
===
|
|
||||||
|
|
||||||
const
|
|
||||||
a = 1.234567890;
|
|
||||||
b = 1234567890.0;
|
|
||||||
c = -1.2;
|
|
||||||
d = +1.2;
|
|
||||||
e = 1.2e3;
|
|
||||||
f = 1.2e-3;
|
|
||||||
g = .123;
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
(root
|
|
||||||
(declConsts (kConst)
|
|
||||||
(declConst (identifier)
|
|
||||||
(defaultValue (kEq) (literalNumber)))
|
|
||||||
(declConst (identifier)
|
|
||||||
(defaultValue (kEq) (literalNumber)))
|
|
||||||
(declConst (identifier)
|
|
||||||
(defaultValue (kEq) (literalNumber)))
|
|
||||||
(declConst (identifier)
|
|
||||||
(defaultValue (kEq) (literalNumber)))
|
|
||||||
(declConst (identifier)
|
|
||||||
(defaultValue (kEq) (literalNumber)))
|
|
||||||
(declConst (identifier)
|
|
||||||
(defaultValue (kEq) (literalNumber)))
|
|
||||||
(declConst (identifier)
|
|
||||||
(defaultValue (kEq) (literalNumber)))))
|
|
||||||
|
|
||||||
===
|
|
||||||
Strings
|
|
||||||
===
|
|
||||||
|
|
||||||
const
|
|
||||||
a = 'Hello World';
|
|
||||||
b = #123;
|
|
||||||
c = #13#10;
|
|
||||||
d = 'Hello'#13#10'World';
|
|
||||||
e = 'Hello'#$0c#$0a'World'#13#10;
|
|
||||||
|
|
||||||
===
|
|
||||||
Array initializer
|
|
||||||
===
|
|
||||||
|
|
||||||
const
|
|
||||||
a: array of integer = (1, 2, 3, 4, 5);
|
|
||||||
a: array[0..2, 0..2] of integer =
|
|
||||||
(
|
|
||||||
(1, 2, 3),
|
|
||||||
(4, 5, 6),
|
|
||||||
(7, 8, 9)
|
|
||||||
);
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
(root
|
|
||||||
(declConsts (kConst)
|
|
||||||
(declConst (identifier)
|
|
||||||
(type (declArray (kArray) (kOf) (type (typeref (identifier)))))
|
|
||||||
(defaultValue (kEq)
|
|
||||||
(arrInitializer
|
|
||||||
(literalNumber)
|
|
||||||
(literalNumber)
|
|
||||||
(literalNumber)
|
|
||||||
(literalNumber)
|
|
||||||
(literalNumber))))
|
|
||||||
(declConst (identifier)
|
|
||||||
(type
|
|
||||||
(declArray (kArray)
|
|
||||||
(range (literalNumber) (literalNumber))
|
|
||||||
(range (literalNumber) (literalNumber))
|
|
||||||
(kOf)
|
|
||||||
(type (typeref (identifier)))))
|
|
||||||
(defaultValue (kEq)
|
|
||||||
(arrInitializer
|
|
||||||
(arrInitializer
|
|
||||||
(literalNumber)
|
|
||||||
(literalNumber)
|
|
||||||
(literalNumber))
|
|
||||||
(arrInitializer
|
|
||||||
(literalNumber)
|
|
||||||
(literalNumber)
|
|
||||||
(literalNumber))
|
|
||||||
(arrInitializer
|
|
||||||
(literalNumber)
|
|
||||||
(literalNumber)
|
|
||||||
(literalNumber)))))))
|
|
||||||
|
|
||||||
|
|
||||||
===
|
|
||||||
Record initializer
|
|
||||||
===
|
|
||||||
|
|
||||||
const
|
|
||||||
a: TMyRec = (a: 1; b: 2; c: (d: 3; e: 4); 567);
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
(root
|
|
||||||
(declConsts (kConst)
|
|
||||||
(declConst (identifier) (type (typeref (identifier)))
|
|
||||||
(defaultValue (kEq)
|
|
||||||
(recInitializer
|
|
||||||
(recInitializerField (identifier) (literalNumber))
|
|
||||||
(recInitializerField (identifier) (literalNumber))
|
|
||||||
(recInitializerField (identifier)
|
|
||||||
(recInitializer
|
|
||||||
(recInitializerField (identifier) (literalNumber))
|
|
||||||
(recInitializerField (identifier) (literalNumber))))
|
|
||||||
(recInitializerField (literalNumber)))))))
|
|
||||||
|
|
||||||
===
|
|
||||||
Sets
|
|
||||||
===
|
|
||||||
|
|
||||||
const
|
|
||||||
a = [0..9, 'a'..'f', 'A'..'F'];
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
(root
|
|
||||||
(declConsts (kConst)
|
|
||||||
(declConst (identifier)
|
|
||||||
(defaultValue (kEq)
|
|
||||||
(exprBrackets
|
|
||||||
(range (literalNumber) (literalNumber))
|
|
||||||
(range (literalString) (literalString))
|
|
||||||
(range (literalString) (literalString)))))))
|
|
||||||
|
|
||||||
===
|
|
||||||
Constant expression
|
|
||||||
===
|
|
||||||
|
|
||||||
const
|
|
||||||
a = +1.2 + 3.4;
|
|
||||||
a = +1.2 + +3.4;
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
(root
|
|
||||||
(declConsts (kConst)
|
|
||||||
(declConst (identifier)
|
|
||||||
(defaultValue (kEq)
|
|
||||||
(exprBinary
|
|
||||||
(literalNumber)
|
|
||||||
(kAdd)
|
|
||||||
(literalNumber))))
|
|
||||||
(declConst (identifier)
|
|
||||||
(defaultValue (kEq)
|
|
||||||
(exprBinary
|
|
||||||
(literalNumber)
|
|
||||||
(kAdd)
|
|
||||||
(literalNumber))))))
|
|
||||||
@ -1,327 +0,0 @@
|
|||||||
===
|
|
||||||
Program 1 - Empty
|
|
||||||
===
|
|
||||||
|
|
||||||
program a;
|
|
||||||
begin
|
|
||||||
end.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
(root
|
|
||||||
(program (kProgram) (moduleName (identifier))
|
|
||||||
(block
|
|
||||||
(kBegin)
|
|
||||||
(kEnd))
|
|
||||||
(kEndDot)))
|
|
||||||
|
|
||||||
|
|
||||||
===
|
|
||||||
Program 2 - Variables
|
|
||||||
===
|
|
||||||
|
|
||||||
program a;
|
|
||||||
var
|
|
||||||
b: c;
|
|
||||||
begin
|
|
||||||
end.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
(root
|
|
||||||
(program (kProgram) (moduleName (identifier))
|
|
||||||
(declVars (kVar)
|
|
||||||
(declVar (identifier) (type (typeref (identifier)))))
|
|
||||||
(block
|
|
||||||
(kBegin)
|
|
||||||
(kEnd))
|
|
||||||
(kEndDot)))
|
|
||||||
|
|
||||||
|
|
||||||
===
|
|
||||||
Program 3 - Subroutines
|
|
||||||
===
|
|
||||||
|
|
||||||
program a;
|
|
||||||
var
|
|
||||||
b: c;
|
|
||||||
|
|
||||||
procedure d;
|
|
||||||
begin
|
|
||||||
end;
|
|
||||||
|
|
||||||
begin
|
|
||||||
d;
|
|
||||||
end.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
(root
|
|
||||||
(program
|
|
||||||
(kProgram)
|
|
||||||
(moduleName
|
|
||||||
(identifier))
|
|
||||||
(declVars
|
|
||||||
(kVar)
|
|
||||||
(declVar
|
|
||||||
(identifier)
|
|
||||||
(type
|
|
||||||
(typeref
|
|
||||||
(identifier)))))
|
|
||||||
(defProc
|
|
||||||
(declProc
|
|
||||||
(kProcedure)
|
|
||||||
(identifier))
|
|
||||||
(block
|
|
||||||
(kBegin)
|
|
||||||
(kEnd)))
|
|
||||||
(block
|
|
||||||
(kBegin)
|
|
||||||
(statement
|
|
||||||
(identifier))
|
|
||||||
(kEnd))
|
|
||||||
(kEndDot)))
|
|
||||||
|
|
||||||
|
|
||||||
===
|
|
||||||
Library 1 - Empty
|
|
||||||
===
|
|
||||||
|
|
||||||
library a;
|
|
||||||
end.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
(root
|
|
||||||
(library (kLibrary) (moduleName (identifier))
|
|
||||||
(kEnd)
|
|
||||||
(kEndDot)))
|
|
||||||
|
|
||||||
===
|
|
||||||
Library 2 - Main Function
|
|
||||||
===
|
|
||||||
|
|
||||||
library a;
|
|
||||||
begin
|
|
||||||
end.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
(root
|
|
||||||
(library (kLibrary) (moduleName (identifier))
|
|
||||||
(block
|
|
||||||
(kBegin)
|
|
||||||
(kEnd))
|
|
||||||
(kEndDot)))
|
|
||||||
|
|
||||||
|
|
||||||
===
|
|
||||||
Unit 1 - Empty
|
|
||||||
===
|
|
||||||
|
|
||||||
unit a;
|
|
||||||
interface
|
|
||||||
implementation
|
|
||||||
end.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
(root
|
|
||||||
(unit (kUnit) (moduleName (identifier))
|
|
||||||
(interface (kInterface))
|
|
||||||
(implementation (kImplementation))
|
|
||||||
(kEnd)
|
|
||||||
(kEndDot)))
|
|
||||||
|
|
||||||
===
|
|
||||||
Unit 2 - All sections
|
|
||||||
===
|
|
||||||
|
|
||||||
unit a;
|
|
||||||
interface
|
|
||||||
implementation
|
|
||||||
initialization
|
|
||||||
finalization
|
|
||||||
end.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
(root
|
|
||||||
(unit (kUnit) (moduleName (identifier))
|
|
||||||
(interface (kInterface))
|
|
||||||
(implementation (kImplementation))
|
|
||||||
(initialization (kInitialization))
|
|
||||||
(finalization (kFinalization))
|
|
||||||
(kEnd)
|
|
||||||
(kEndDot)))
|
|
||||||
|
|
||||||
===
|
|
||||||
Unit 3 - Routines
|
|
||||||
===
|
|
||||||
|
|
||||||
unit a;
|
|
||||||
|
|
||||||
interface
|
|
||||||
|
|
||||||
procedure a;
|
|
||||||
function b: c;
|
|
||||||
|
|
||||||
implementation
|
|
||||||
|
|
||||||
procedure d; forward;
|
|
||||||
|
|
||||||
procedure a;
|
|
||||||
begin
|
|
||||||
d;
|
|
||||||
end;
|
|
||||||
|
|
||||||
function b: c;
|
|
||||||
begin
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure d;
|
|
||||||
begin
|
|
||||||
end;
|
|
||||||
|
|
||||||
end.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
(root
|
|
||||||
(unit (kUnit) (moduleName (identifier))
|
|
||||||
(interface (kInterface)
|
|
||||||
(declProc (kProcedure) (identifier))
|
|
||||||
(declProc (kFunction) (identifier) (typeref (identifier))))
|
|
||||||
(implementation (kImplementation)
|
|
||||||
(declProc (kProcedure) (identifier) (kForward))
|
|
||||||
(defProc
|
|
||||||
(declProc (kProcedure) (identifier))
|
|
||||||
(block
|
|
||||||
(kBegin)
|
|
||||||
(statement (identifier))
|
|
||||||
(kEnd)))
|
|
||||||
(defProc
|
|
||||||
(declProc (kFunction) (identifier) (typeref (identifier)))
|
|
||||||
(block
|
|
||||||
(kBegin)
|
|
||||||
(kEnd)))
|
|
||||||
(defProc
|
|
||||||
(declProc (kProcedure) (identifier))
|
|
||||||
(block
|
|
||||||
(kBegin)
|
|
||||||
(kEnd))))
|
|
||||||
(kEnd)
|
|
||||||
(kEndDot)))
|
|
||||||
|
|
||||||
|
|
||||||
===
|
|
||||||
Unit 4 - Namespaces
|
|
||||||
===
|
|
||||||
|
|
||||||
unit a.b.c;
|
|
||||||
|
|
||||||
interface
|
|
||||||
|
|
||||||
uses
|
|
||||||
d.e.f, g, h;
|
|
||||||
|
|
||||||
implementation
|
|
||||||
|
|
||||||
uses
|
|
||||||
i, j.h;
|
|
||||||
|
|
||||||
end.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
(root
|
|
||||||
(unit (kUnit)
|
|
||||||
(moduleName
|
|
||||||
(identifier)
|
|
||||||
(kDot)
|
|
||||||
(identifier)
|
|
||||||
(kDot)
|
|
||||||
(identifier))
|
|
||||||
(interface (kInterface)
|
|
||||||
(declUses (kUses)
|
|
||||||
(moduleName
|
|
||||||
(identifier)
|
|
||||||
(kDot)
|
|
||||||
(identifier)
|
|
||||||
(kDot)
|
|
||||||
(identifier))
|
|
||||||
(moduleName
|
|
||||||
(identifier))
|
|
||||||
(moduleName
|
|
||||||
(identifier))))
|
|
||||||
(implementation (kImplementation)
|
|
||||||
(declUses (kUses)
|
|
||||||
(moduleName
|
|
||||||
(identifier))
|
|
||||||
(moduleName
|
|
||||||
(identifier)
|
|
||||||
(kDot)
|
|
||||||
(identifier))))
|
|
||||||
(kEnd)
|
|
||||||
(kEndDot)))
|
|
||||||
|
|
||||||
|
|
||||||
===
|
|
||||||
Unit 5 - Classes
|
|
||||||
===
|
|
||||||
|
|
||||||
unit a;
|
|
||||||
|
|
||||||
interface
|
|
||||||
|
|
||||||
type
|
|
||||||
b = class
|
|
||||||
procedure c;
|
|
||||||
class procedure d;
|
|
||||||
end;
|
|
||||||
|
|
||||||
implementation
|
|
||||||
|
|
||||||
procedure b.c;
|
|
||||||
begin
|
|
||||||
end;
|
|
||||||
|
|
||||||
class procedure b.d;
|
|
||||||
begin
|
|
||||||
end;
|
|
||||||
|
|
||||||
end.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
(root
|
|
||||||
(unit (kUnit) (moduleName (identifier))
|
|
||||||
(interface (kInterface)
|
|
||||||
(declTypes (kType)
|
|
||||||
(declType (identifier) (kEq)
|
|
||||||
(declClass (kClass)
|
|
||||||
(declProc (kProcedure) (identifier))
|
|
||||||
(declProc (kClass) (kProcedure) (identifier))
|
|
||||||
(kEnd)))))
|
|
||||||
(implementation (kImplementation)
|
|
||||||
(defProc
|
|
||||||
(declProc (kProcedure)
|
|
||||||
(genericDot
|
|
||||||
(identifier)
|
|
||||||
(kDot)
|
|
||||||
(identifier)))
|
|
||||||
(block
|
|
||||||
(kBegin)
|
|
||||||
(kEnd)))
|
|
||||||
(defProc
|
|
||||||
(declProc (kClass) (kProcedure)
|
|
||||||
(genericDot
|
|
||||||
(identifier)
|
|
||||||
(kDot)
|
|
||||||
(identifier)))
|
|
||||||
(block
|
|
||||||
(kBegin)
|
|
||||||
(kEnd))))
|
|
||||||
(kEnd)
|
|
||||||
(kEndDot)))
|
|
||||||
|
|
||||||
@ -1,146 +0,0 @@
|
|||||||
===
|
|
||||||
objcclass
|
|
||||||
===
|
|
||||||
|
|
||||||
type
|
|
||||||
|
|
||||||
NSView = objcclass external (NSResponder)
|
|
||||||
private
|
|
||||||
_subview : id;
|
|
||||||
public
|
|
||||||
function initWithFrame(rect : NSRect): id; message 'initWithFrame:';
|
|
||||||
procedure addSubview(aview: NSView); message 'addSubview:';
|
|
||||||
procedure setAutoresizingMask(mask: NSUInteger); message 'setAutoresizingMask:';
|
|
||||||
procedure setAutoresizesSubviews(flag: LongBool); message 'setAutoresizesSubviews:';
|
|
||||||
procedure drawRect(dirtyRect: NSRect); message 'drawRect:';
|
|
||||||
end;
|
|
||||||
|
|
||||||
MyView = objcclass(MSView)
|
|
||||||
public
|
|
||||||
data : Integer;
|
|
||||||
procedure customMessage(dirtyRect: NSRect); message 'customMessage';
|
|
||||||
procedure drawRect(dirtyRect: NSRect); override;
|
|
||||||
end;
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
(root
|
|
||||||
(declTypes (kType)
|
|
||||||
(declType (identifier) (kEq)
|
|
||||||
(declClass (kObjcclass) (kExternal) (typeref (identifier))
|
|
||||||
(declSection (kPrivate)
|
|
||||||
(declField (identifier) (type (typeref (identifier)))))
|
|
||||||
(declSection (kPublic)
|
|
||||||
(declProc (kFunction) (identifier)
|
|
||||||
(declArgs
|
|
||||||
(declArg (identifier) (type (typeref (identifier)))))
|
|
||||||
(typeref (identifier))
|
|
||||||
(procAttribute (kMessage) (literalString)))
|
|
||||||
(declProc (kProcedure) (identifier)
|
|
||||||
(declArgs
|
|
||||||
(declArg (identifier) (type (typeref (identifier)))))
|
|
||||||
(procAttribute (kMessage) (literalString)))
|
|
||||||
(declProc (kProcedure) (identifier)
|
|
||||||
(declArgs
|
|
||||||
(declArg (identifier) (type (typeref (identifier)))))
|
|
||||||
(procAttribute (kMessage) (literalString)))
|
|
||||||
(declProc (kProcedure) (identifier)
|
|
||||||
(declArgs
|
|
||||||
(declArg (identifier) (type (typeref (identifier)))))
|
|
||||||
(procAttribute (kMessage) (literalString)))
|
|
||||||
(declProc (kProcedure) (identifier)
|
|
||||||
(declArgs
|
|
||||||
(declArg (identifier) (type (typeref (identifier)))))
|
|
||||||
(procAttribute (kMessage) (literalString))))
|
|
||||||
(kEnd)))
|
|
||||||
(declType (identifier) (kEq)
|
|
||||||
(declClass (kObjcclass)
|
|
||||||
(typeref (identifier))
|
|
||||||
(declSection (kPublic)
|
|
||||||
(declField (identifier) (type (typeref (identifier))))
|
|
||||||
(declProc (kProcedure) (identifier)
|
|
||||||
(declArgs
|
|
||||||
(declArg (identifier) (type (typeref (identifier)))))
|
|
||||||
(procAttribute (kMessage) (literalString)))
|
|
||||||
(declProc (kProcedure) (identifier)
|
|
||||||
(declArgs
|
|
||||||
(declArg (identifier) (type (typeref (identifier)))))
|
|
||||||
(procAttribute (kOverride))))
|
|
||||||
(kEnd)))))
|
|
||||||
|
|
||||||
===
|
|
||||||
objcprotocol
|
|
||||||
===
|
|
||||||
|
|
||||||
type
|
|
||||||
MyProtocol = objcprotocol
|
|
||||||
procedure aRequiredMethod; message 'aRequiredMethod';
|
|
||||||
optional
|
|
||||||
procedure anOptionalMethodWithPara(para: longint); message 'anOptionalMethodWithPara:';
|
|
||||||
procedure anotherOptionalMethod; message 'anotherOptionalMethod';
|
|
||||||
required
|
|
||||||
function aSecondRequiredMethod: longint; message 'aSecondRequiredMethod';
|
|
||||||
end;
|
|
||||||
|
|
||||||
MyClassImplementingProtocol = objcclass(NSObject,MyProtocol)
|
|
||||||
procedure aRequiredMethod;
|
|
||||||
procedure anOptionalMethodWithPara(para: longint);
|
|
||||||
function aSecondRequiredMethod: longint;
|
|
||||||
end;
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
(root
|
|
||||||
(declTypes (kType)
|
|
||||||
(declType (identifier) (kEq)
|
|
||||||
(declClass (kObjcprotocol)
|
|
||||||
(declProc (kProcedure) (identifier) (procAttribute (kMessage) (literalString)))
|
|
||||||
(declSection (kOptional)
|
|
||||||
(declProc (kProcedure) (identifier)
|
|
||||||
(declArgs
|
|
||||||
(declArg (identifier) (type (typeref (identifier)))))
|
|
||||||
(procAttribute (kMessage) (literalString)))
|
|
||||||
(declProc (kProcedure) (identifier)
|
|
||||||
(procAttribute (kMessage) (literalString))))
|
|
||||||
(declSection (kRequired)
|
|
||||||
(declProc (kFunction) (identifier) (typeref (identifier))
|
|
||||||
(procAttribute (kMessage) (literalString))))
|
|
||||||
(kEnd)))
|
|
||||||
(declType (identifier) (kEq)
|
|
||||||
(declClass (kObjcclass)
|
|
||||||
(typeref (identifier))
|
|
||||||
(typeref (identifier))
|
|
||||||
(declProc (kProcedure) (identifier))
|
|
||||||
(declProc (kProcedure) (identifier)
|
|
||||||
(declArgs
|
|
||||||
(declArg (identifier) (type (typeref (identifier))))))
|
|
||||||
(declProc (kFunction) (identifier) (typeref (identifier)))
|
|
||||||
(kEnd)))))
|
|
||||||
|
|
||||||
|
|
||||||
===
|
|
||||||
objccategory
|
|
||||||
===
|
|
||||||
|
|
||||||
type
|
|
||||||
MyCategory = objccategory(NSObject,MyProtocol)
|
|
||||||
function hash: cuint; reintroduce;
|
|
||||||
procedure protocolmethod;
|
|
||||||
class procedure newmethod; message 'newmethod';
|
|
||||||
end;
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
(root
|
|
||||||
(declTypes (kType)
|
|
||||||
(declType (identifier) (kEq)
|
|
||||||
(declClass (kObjccategory)
|
|
||||||
(typeref (identifier))
|
|
||||||
(typeref (identifier))
|
|
||||||
(declProc (kFunction) (identifier) (typeref (identifier))
|
|
||||||
(procAttribute (kReintroduce)))
|
|
||||||
(declProc (kProcedure) (identifier))
|
|
||||||
(declProc (kClass) (kProcedure) (identifier)
|
|
||||||
(procAttribute (kMessage) (literalString)))
|
|
||||||
(kEnd)))))
|
|
||||||
|
|
||||||
@ -1,263 +0,0 @@
|
|||||||
===
|
|
||||||
Line Comments
|
|
||||||
===
|
|
||||||
|
|
||||||
// Hello
|
|
||||||
// World
|
|
||||||
var
|
|
||||||
i: integer; // Hello
|
|
||||||
j: integer;
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
(root
|
|
||||||
(comment)
|
|
||||||
(comment)
|
|
||||||
(declVars (kVar)
|
|
||||||
(declVar (identifier) (type (typeref (identifier))))
|
|
||||||
(comment)
|
|
||||||
(declVar (identifier) (type (typeref (identifier))))))
|
|
||||||
|
|
||||||
===
|
|
||||||
Block Comments 1
|
|
||||||
===
|
|
||||||
|
|
||||||
{ Hello
|
|
||||||
World }
|
|
||||||
var
|
|
||||||
i: { hello }integer; { World }
|
|
||||||
j: integer;
|
|
||||||
|
|
||||||
{ { { { {{ { { { {{{
|
|
||||||
|
|
||||||
{ { {
|
|
||||||
// { {{ { {{ {e/{ {/ /{}
|
|
||||||
k: integer;
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
(root
|
|
||||||
(comment)
|
|
||||||
(declVars (kVar)
|
|
||||||
(declVar (identifier)
|
|
||||||
(comment)
|
|
||||||
(type (typeref (identifier))))
|
|
||||||
(comment)
|
|
||||||
(declVar (identifier)
|
|
||||||
(type (typeref (identifier))))
|
|
||||||
(comment)
|
|
||||||
(declVar (identifier)
|
|
||||||
(type (typeref (identifier))))))
|
|
||||||
|
|
||||||
|
|
||||||
===
|
|
||||||
Block Comments 2
|
|
||||||
===
|
|
||||||
|
|
||||||
(* Hello
|
|
||||||
World *)
|
|
||||||
var
|
|
||||||
i: (* hello *)integer; (* World *)
|
|
||||||
j: integer;
|
|
||||||
(* * * * * * ** * * * ** (* (* (* (* * )
|
|
||||||
) ) { * ****)
|
|
||||||
k: integer;
|
|
||||||
|
|
||||||
(**)
|
|
||||||
l: integer;
|
|
||||||
|
|
||||||
{(**)}
|
|
||||||
n: integer;
|
|
||||||
{(*)}
|
|
||||||
m: integer;
|
|
||||||
(*{}*)
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
(root (comment)
|
|
||||||
(declVars (kVar)
|
|
||||||
(declVar (identifier)
|
|
||||||
(comment)
|
|
||||||
(type (typeref (identifier))))
|
|
||||||
(comment)
|
|
||||||
(declVar (identifier)
|
|
||||||
(type (typeref (identifier))))
|
|
||||||
(comment)
|
|
||||||
(declVar (identifier)
|
|
||||||
(type (typeref (identifier))))
|
|
||||||
(comment)
|
|
||||||
(declVar (identifier)
|
|
||||||
(type (typeref (identifier))))
|
|
||||||
(comment)
|
|
||||||
(declVar (identifier)
|
|
||||||
(type (typeref (identifier))))
|
|
||||||
(comment)
|
|
||||||
(declVar (identifier)
|
|
||||||
(type (typeref (identifier)))))
|
|
||||||
(comment))
|
|
||||||
|
|
||||||
===
|
|
||||||
Preprocessor directives 1
|
|
||||||
===
|
|
||||||
|
|
||||||
{$mode delphi}
|
|
||||||
{$define foo}
|
|
||||||
{$ifdef foo}
|
|
||||||
{$m+}
|
|
||||||
{$I source.inc}
|
|
||||||
{$endif}
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
(root
|
|
||||||
(pp)
|
|
||||||
(pp)
|
|
||||||
(pp)
|
|
||||||
(pp)
|
|
||||||
(pp)
|
|
||||||
(pp))
|
|
||||||
|
|
||||||
===
|
|
||||||
Preprocessor directives 2
|
|
||||||
===
|
|
||||||
|
|
||||||
procedure foo(a: integer{$if 1}; b: float{$endif});
|
|
||||||
begin
|
|
||||||
end;
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
(root
|
|
||||||
(defProc
|
|
||||||
(declProc (kProcedure) (identifier)
|
|
||||||
(declArgs
|
|
||||||
(declArg (identifier)
|
|
||||||
(type (typeref (identifier))))
|
|
||||||
(pp)
|
|
||||||
(declArg (identifier)
|
|
||||||
(type (typeref (identifier))))
|
|
||||||
(pp)))
|
|
||||||
(block
|
|
||||||
(kBegin)
|
|
||||||
(kEnd))))
|
|
||||||
|
|
||||||
===
|
|
||||||
Preprocessor directives 3
|
|
||||||
===
|
|
||||||
|
|
||||||
procedure foo(a: {$if 1}integer{$else}float{$endif});
|
|
||||||
begin
|
|
||||||
end;
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
(root
|
|
||||||
(defProc
|
|
||||||
(declProc (kProcedure) (identifier)
|
|
||||||
(declArgs
|
|
||||||
(declArg (identifier)
|
|
||||||
(type
|
|
||||||
(pp)
|
|
||||||
(typeref (identifier))
|
|
||||||
(pp)
|
|
||||||
(typeref (identifier))
|
|
||||||
(pp)))))
|
|
||||||
(block
|
|
||||||
(kBegin)
|
|
||||||
(kEnd))))
|
|
||||||
|
|
||||||
===
|
|
||||||
Preprocessor directives 4
|
|
||||||
===
|
|
||||||
|
|
||||||
procedure a;
|
|
||||||
begin
|
|
||||||
{$if 1}
|
|
||||||
if true then
|
|
||||||
WriteLn('Hello');
|
|
||||||
{$elseif 1}
|
|
||||||
while true do
|
|
||||||
WriteLn('World');
|
|
||||||
{$else}
|
|
||||||
WriteLn('Foo');
|
|
||||||
{$endif}
|
|
||||||
end;
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
(root
|
|
||||||
(defProc
|
|
||||||
(declProc (kProcedure) (identifier))
|
|
||||||
(block
|
|
||||||
(kBegin)
|
|
||||||
(pp)
|
|
||||||
(if (kIf) (kTrue) (kThen)
|
|
||||||
(statement (exprCall (identifier) (exprArgs (literalString)))))
|
|
||||||
(pp)
|
|
||||||
(while (kWhile) (kTrue) (kDo)
|
|
||||||
(statement (exprCall (identifier) (exprArgs (literalString)))))
|
|
||||||
(pp)
|
|
||||||
(statement (exprCall (identifier) (exprArgs (literalString))))
|
|
||||||
(pp)
|
|
||||||
(kEnd))))
|
|
||||||
|
|
||||||
===
|
|
||||||
Preprocessor directives 5
|
|
||||||
===
|
|
||||||
|
|
||||||
procedure a;
|
|
||||||
{$ifdef WIN32}
|
|
||||||
begin
|
|
||||||
end;
|
|
||||||
{$else}
|
|
||||||
begin
|
|
||||||
end;
|
|
||||||
{$endif}
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
(root
|
|
||||||
(defProc
|
|
||||||
(declProc (kProcedure) (identifier))
|
|
||||||
(pp)
|
|
||||||
(block
|
|
||||||
(kBegin)
|
|
||||||
(kEnd))
|
|
||||||
(pp)
|
|
||||||
(block
|
|
||||||
(kBegin)
|
|
||||||
(kEnd))
|
|
||||||
(pp)))
|
|
||||||
|
|
||||||
===
|
|
||||||
Preprocessor directives 6
|
|
||||||
===
|
|
||||||
|
|
||||||
var
|
|
||||||
a: {$if 1}b{$else}c{$endif};
|
|
||||||
|
|
||||||
type
|
|
||||||
a = {$if 1}b{$else}c{$endif};
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
(root
|
|
||||||
(declVars (kVar)
|
|
||||||
(declVar (identifier)
|
|
||||||
(type
|
|
||||||
(pp)
|
|
||||||
(typeref (identifier))
|
|
||||||
(pp)
|
|
||||||
(typeref (identifier))
|
|
||||||
(pp))))
|
|
||||||
(declTypes (kType)
|
|
||||||
(declType
|
|
||||||
(identifier)
|
|
||||||
(kEq)
|
|
||||||
(type
|
|
||||||
(pp)
|
|
||||||
(typeref (identifier))
|
|
||||||
(pp)
|
|
||||||
(typeref (identifier))
|
|
||||||
(pp)))))
|
|
||||||
|
|
||||||
@ -1,348 +0,0 @@
|
|||||||
===
|
|
||||||
Arguments
|
|
||||||
===
|
|
||||||
|
|
||||||
procedure a;
|
|
||||||
begin
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure a(b: c);
|
|
||||||
begin
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure a(b, c: d);
|
|
||||||
begin
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure a(b, c: d; e, f: g);
|
|
||||||
begin
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure a(var b: c; const d: e; out f: g);
|
|
||||||
begin
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure a(var b; const b; out c);
|
|
||||||
begin
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure a(var b, c: d; const e, f);
|
|
||||||
begin
|
|
||||||
end;
|
|
||||||
|
|
||||||
function a: b;
|
|
||||||
begin
|
|
||||||
end;
|
|
||||||
|
|
||||||
function a(b: c): d;
|
|
||||||
begin
|
|
||||||
end;
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
(root
|
|
||||||
(defProc
|
|
||||||
(declProc (kProcedure) (identifier))
|
|
||||||
(block (kBegin) (kEnd)))
|
|
||||||
(defProc
|
|
||||||
(declProc (kProcedure) (identifier)
|
|
||||||
(declArgs
|
|
||||||
(declArg
|
|
||||||
(identifier)
|
|
||||||
(type (typeref (identifier))))))
|
|
||||||
(block (kBegin) (kEnd)))
|
|
||||||
(defProc
|
|
||||||
(declProc (kProcedure) (identifier)
|
|
||||||
(declArgs
|
|
||||||
(declArg
|
|
||||||
(identifier)
|
|
||||||
(identifier)
|
|
||||||
(type (typeref (identifier))))))
|
|
||||||
(block (kBegin) (kEnd)))
|
|
||||||
(defProc
|
|
||||||
(declProc (kProcedure) (identifier)
|
|
||||||
(declArgs
|
|
||||||
(declArg
|
|
||||||
(identifier)
|
|
||||||
(identifier)
|
|
||||||
(type (typeref (identifier))))
|
|
||||||
(declArg
|
|
||||||
(identifier)
|
|
||||||
(identifier)
|
|
||||||
(type (typeref (identifier))))))
|
|
||||||
(block (kBegin) (kEnd)))
|
|
||||||
(defProc
|
|
||||||
(declProc (kProcedure) (identifier)
|
|
||||||
(declArgs
|
|
||||||
(declArg (kVar)
|
|
||||||
(identifier)
|
|
||||||
(type (typeref (identifier))))
|
|
||||||
(declArg (kConst)
|
|
||||||
(identifier)
|
|
||||||
(type (typeref (identifier))))
|
|
||||||
(declArg
|
|
||||||
(kOut)
|
|
||||||
(identifier)
|
|
||||||
(type (typeref (identifier))))))
|
|
||||||
(block (kBegin) (kEnd)))
|
|
||||||
(defProc
|
|
||||||
(declProc (kProcedure) (identifier)
|
|
||||||
(declArgs
|
|
||||||
(declArg (kVar) (identifier))
|
|
||||||
(declArg (kConst) (identifier))
|
|
||||||
(declArg (kOut) (identifier))))
|
|
||||||
(block (kBegin) (kEnd)))
|
|
||||||
(defProc
|
|
||||||
(declProc (kProcedure) (identifier)
|
|
||||||
(declArgs
|
|
||||||
(declArg (kVar)
|
|
||||||
(identifier)
|
|
||||||
(identifier)
|
|
||||||
(type (typeref (identifier))))
|
|
||||||
(declArg (kConst)
|
|
||||||
(identifier)
|
|
||||||
(identifier))))
|
|
||||||
(block (kBegin) (kEnd)))
|
|
||||||
(defProc
|
|
||||||
(declProc (kFunction) (identifier)
|
|
||||||
(typeref (identifier)))
|
|
||||||
(block (kBegin) (kEnd)))
|
|
||||||
(defProc
|
|
||||||
(declProc (kFunction) (identifier)
|
|
||||||
(declArgs
|
|
||||||
(declArg
|
|
||||||
(identifier)
|
|
||||||
(type (typeref (identifier)))))
|
|
||||||
(typeref (identifier)))
|
|
||||||
(block (kBegin) (kEnd))))
|
|
||||||
|
|
||||||
===
|
|
||||||
Methods
|
|
||||||
===
|
|
||||||
|
|
||||||
procedure a.b;
|
|
||||||
begin
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure a.b(c: d);
|
|
||||||
begin
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure a.b.c;
|
|
||||||
begin
|
|
||||||
end;
|
|
||||||
|
|
||||||
constructor a.b;
|
|
||||||
begin
|
|
||||||
end;
|
|
||||||
|
|
||||||
destructor a.b;
|
|
||||||
begin
|
|
||||||
end;
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
(root
|
|
||||||
(defProc
|
|
||||||
(declProc (kProcedure)
|
|
||||||
(genericDot
|
|
||||||
(identifier)
|
|
||||||
(kDot)
|
|
||||||
(identifier)))
|
|
||||||
(block (kBegin) (kEnd)))
|
|
||||||
(defProc
|
|
||||||
(declProc
|
|
||||||
(kProcedure)
|
|
||||||
(genericDot
|
|
||||||
(identifier)
|
|
||||||
(kDot)
|
|
||||||
(identifier))
|
|
||||||
(declArgs
|
|
||||||
(declArg
|
|
||||||
(identifier)
|
|
||||||
(type (typeref (identifier))))))
|
|
||||||
(block (kBegin) (kEnd)))
|
|
||||||
(defProc
|
|
||||||
(declProc (kProcedure)
|
|
||||||
(genericDot
|
|
||||||
(genericDot
|
|
||||||
(identifier)
|
|
||||||
(kDot)
|
|
||||||
(identifier))
|
|
||||||
(kDot)
|
|
||||||
(identifier)))
|
|
||||||
(block (kBegin) (kEnd)))
|
|
||||||
(defProc
|
|
||||||
(declProc (kConstructor)
|
|
||||||
(genericDot
|
|
||||||
(identifier)
|
|
||||||
(kDot)
|
|
||||||
(identifier)))
|
|
||||||
(block (kBegin) (kEnd)))
|
|
||||||
(defProc
|
|
||||||
(declProc (kDestructor)
|
|
||||||
(genericDot
|
|
||||||
(identifier)
|
|
||||||
(kDot)
|
|
||||||
(identifier)))
|
|
||||||
(block (kBegin) (kEnd))))
|
|
||||||
|
|
||||||
===
|
|
||||||
Operators
|
|
||||||
===
|
|
||||||
|
|
||||||
operator a.+(b, c: d): e;
|
|
||||||
begin
|
|
||||||
end;
|
|
||||||
|
|
||||||
operator a.sub(b, c: d): e;
|
|
||||||
begin
|
|
||||||
end;
|
|
||||||
|
|
||||||
operator a.b.c.+(d, e: f): g;
|
|
||||||
begin
|
|
||||||
end;
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
(root
|
|
||||||
(defProc
|
|
||||||
(declProc (kOperator)
|
|
||||||
(genericDot
|
|
||||||
(identifier)
|
|
||||||
(kDot)
|
|
||||||
(operatorName (kAdd)))
|
|
||||||
(declArgs
|
|
||||||
(declArg
|
|
||||||
(identifier)
|
|
||||||
(identifier)
|
|
||||||
(type (typeref (identifier)))))
|
|
||||||
(type (typeref (identifier))))
|
|
||||||
(block
|
|
||||||
(kBegin)
|
|
||||||
(kEnd)))
|
|
||||||
(defProc
|
|
||||||
(declProc (kOperator)
|
|
||||||
(genericDot
|
|
||||||
(identifier)
|
|
||||||
(kDot)
|
|
||||||
(identifier))
|
|
||||||
(declArgs
|
|
||||||
(declArg
|
|
||||||
(identifier)
|
|
||||||
(identifier)
|
|
||||||
(type (typeref (identifier)))))
|
|
||||||
(type (typeref (identifier))))
|
|
||||||
(block
|
|
||||||
(kBegin)
|
|
||||||
(kEnd)))
|
|
||||||
(defProc
|
|
||||||
(declProc (kOperator)
|
|
||||||
(genericDot
|
|
||||||
(genericDot
|
|
||||||
(genericDot
|
|
||||||
(identifier)
|
|
||||||
(kDot)
|
|
||||||
(identifier))
|
|
||||||
(kDot)
|
|
||||||
(identifier))
|
|
||||||
(kDot)
|
|
||||||
(operatorName (kAdd)))
|
|
||||||
(declArgs
|
|
||||||
(declArg
|
|
||||||
(identifier)
|
|
||||||
(identifier)
|
|
||||||
(type (typeref (identifier)))))
|
|
||||||
(type (typeref (identifier))))
|
|
||||||
(block
|
|
||||||
(kBegin)
|
|
||||||
(kEnd))))
|
|
||||||
|
|
||||||
|
|
||||||
===
|
|
||||||
Locals
|
|
||||||
===
|
|
||||||
|
|
||||||
procedure a;
|
|
||||||
type
|
|
||||||
b = c;
|
|
||||||
var
|
|
||||||
d: e;
|
|
||||||
const
|
|
||||||
f = g;
|
|
||||||
begin
|
|
||||||
end;
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
(root
|
|
||||||
(defProc
|
|
||||||
(declProc (kProcedure) (identifier))
|
|
||||||
(declTypes (kType)
|
|
||||||
(declType (identifier) (kEq) (type (typeref (identifier)))))
|
|
||||||
(declVars (kVar)
|
|
||||||
(declVar (identifier) (type (typeref (identifier)))))
|
|
||||||
(declConsts (kConst)
|
|
||||||
(declConst (identifier) (defaultValue (kEq) (identifier))))
|
|
||||||
(block
|
|
||||||
(kBegin)
|
|
||||||
(kEnd))))
|
|
||||||
|
|
||||||
|
|
||||||
===
|
|
||||||
Nested routines
|
|
||||||
===
|
|
||||||
|
|
||||||
procedure a;
|
|
||||||
function b: c;
|
|
||||||
procedure d;
|
|
||||||
begin
|
|
||||||
end;
|
|
||||||
begin
|
|
||||||
end;
|
|
||||||
begin
|
|
||||||
end;
|
|
||||||
|
|
||||||
function a: b;
|
|
||||||
var c: d;
|
|
||||||
procedure e;
|
|
||||||
var
|
|
||||||
f: g;
|
|
||||||
begin
|
|
||||||
end;
|
|
||||||
begin
|
|
||||||
end;
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
(root
|
|
||||||
(defProc
|
|
||||||
(declProc (kProcedure) (identifier))
|
|
||||||
(defProc
|
|
||||||
(declProc (kFunction) (identifier) (typeref (identifier)))
|
|
||||||
(defProc
|
|
||||||
(declProc (kProcedure) (identifier))
|
|
||||||
(block
|
|
||||||
(kBegin)
|
|
||||||
(kEnd)))
|
|
||||||
(block
|
|
||||||
(kBegin)
|
|
||||||
(kEnd)))
|
|
||||||
(block
|
|
||||||
(kBegin)
|
|
||||||
(kEnd)))
|
|
||||||
(defProc
|
|
||||||
(declProc (kFunction) (identifier) (typeref (identifier)))
|
|
||||||
(declVars (kVar)
|
|
||||||
(declVar (identifier) (type (typeref (identifier)))))
|
|
||||||
(defProc
|
|
||||||
(declProc (kProcedure) (identifier))
|
|
||||||
(declVars (kVar)
|
|
||||||
(declVar (identifier) (type (typeref (identifier)))))
|
|
||||||
(block
|
|
||||||
(kBegin)
|
|
||||||
(kEnd)))
|
|
||||||
(block
|
|
||||||
(kBegin)
|
|
||||||
(kEnd))))
|
|
||||||
|
|
||||||
@ -1,763 +0,0 @@
|
|||||||
===
|
|
||||||
if
|
|
||||||
===
|
|
||||||
|
|
||||||
procedure Main;
|
|
||||||
begin
|
|
||||||
if a then
|
|
||||||
b;
|
|
||||||
|
|
||||||
if a then
|
|
||||||
b
|
|
||||||
else
|
|
||||||
c;
|
|
||||||
|
|
||||||
if a then
|
|
||||||
begin
|
|
||||||
end;
|
|
||||||
|
|
||||||
if a then
|
|
||||||
begin
|
|
||||||
b;
|
|
||||||
end
|
|
||||||
else
|
|
||||||
begin
|
|
||||||
c;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
(root
|
|
||||||
(defProc
|
|
||||||
(declProc (kProcedure) (identifier))
|
|
||||||
(block
|
|
||||||
(kBegin)
|
|
||||||
(if (kIf) (identifier) (kThen)
|
|
||||||
(statement (identifier)))
|
|
||||||
(ifElse (kIf) (identifier) (kThen)
|
|
||||||
(statement (identifier))
|
|
||||||
(kElse)
|
|
||||||
(statement (identifier)))
|
|
||||||
(if (kIf) (identifier) (kThen)
|
|
||||||
(block
|
|
||||||
(kBegin)
|
|
||||||
(kEnd)))
|
|
||||||
(ifElse
|
|
||||||
(kIf) (identifier) (kThen)
|
|
||||||
(block
|
|
||||||
(kBegin)
|
|
||||||
(statement (identifier))
|
|
||||||
(kEnd))
|
|
||||||
(kElse)
|
|
||||||
(block
|
|
||||||
(kBegin)
|
|
||||||
(statement (identifier))
|
|
||||||
(kEnd)))
|
|
||||||
(kEnd))))
|
|
||||||
|
|
||||||
===
|
|
||||||
nested if
|
|
||||||
===
|
|
||||||
|
|
||||||
procedure Main;
|
|
||||||
begin
|
|
||||||
if a then
|
|
||||||
if b then
|
|
||||||
c
|
|
||||||
else
|
|
||||||
d;
|
|
||||||
|
|
||||||
if a then
|
|
||||||
if b then
|
|
||||||
c;
|
|
||||||
else
|
|
||||||
d;
|
|
||||||
|
|
||||||
if a then
|
|
||||||
b
|
|
||||||
else if c then
|
|
||||||
d
|
|
||||||
else
|
|
||||||
e;
|
|
||||||
end;
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
(root
|
|
||||||
(defProc
|
|
||||||
(declProc (kProcedure) (identifier))
|
|
||||||
(block
|
|
||||||
(kBegin)
|
|
||||||
(if (kIf) (identifier) (kThen)
|
|
||||||
(ifElse (kIf) (identifier) (kThen)
|
|
||||||
(statement (identifier))
|
|
||||||
(kElse)
|
|
||||||
(statement (identifier))))
|
|
||||||
(ifElse (kIf) (identifier) (kThen)
|
|
||||||
(if (kIf) (identifier) (kThen)
|
|
||||||
(statement (identifier)))
|
|
||||||
(kElse)
|
|
||||||
(statement (identifier)))
|
|
||||||
(ifElse (kIf) (identifier) (kThen)
|
|
||||||
(statement (identifier))
|
|
||||||
(kElse)
|
|
||||||
(ifElse (kIf) (identifier) (kThen)
|
|
||||||
(statement (identifier))
|
|
||||||
(kElse)
|
|
||||||
(statement (identifier))))
|
|
||||||
(kEnd))))
|
|
||||||
|
|
||||||
===
|
|
||||||
while loop
|
|
||||||
===
|
|
||||||
|
|
||||||
procedure Main;
|
|
||||||
begin
|
|
||||||
while a do
|
|
||||||
b;
|
|
||||||
|
|
||||||
while a do
|
|
||||||
begin
|
|
||||||
b;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
(root
|
|
||||||
(defProc
|
|
||||||
(declProc (kProcedure) (identifier))
|
|
||||||
(block
|
|
||||||
(kBegin)
|
|
||||||
(while (kWhile) (identifier) (kDo)
|
|
||||||
(statement (identifier)))
|
|
||||||
(while (kWhile) (identifier) (kDo)
|
|
||||||
(block
|
|
||||||
(kBegin)
|
|
||||||
(statement (identifier))
|
|
||||||
(kEnd)))
|
|
||||||
(kEnd))))
|
|
||||||
|
|
||||||
===
|
|
||||||
repeat loop
|
|
||||||
===
|
|
||||||
|
|
||||||
procedure Main;
|
|
||||||
begin
|
|
||||||
repeat
|
|
||||||
a;
|
|
||||||
until b;
|
|
||||||
|
|
||||||
repeat
|
|
||||||
a;
|
|
||||||
b;
|
|
||||||
until c;
|
|
||||||
|
|
||||||
repeat
|
|
||||||
until b;
|
|
||||||
end;
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
(root
|
|
||||||
(defProc
|
|
||||||
(declProc (kProcedure) (identifier))
|
|
||||||
(block
|
|
||||||
(kBegin)
|
|
||||||
(repeat
|
|
||||||
(kRepeat)
|
|
||||||
(statements
|
|
||||||
(statement (identifier)))
|
|
||||||
(kUntil) (identifier))
|
|
||||||
(repeat
|
|
||||||
(kRepeat)
|
|
||||||
(statements
|
|
||||||
(statement (identifier))
|
|
||||||
(statement (identifier)))
|
|
||||||
(kUntil) (identifier))
|
|
||||||
(repeat
|
|
||||||
(kRepeat)
|
|
||||||
(kUntil) (identifier))
|
|
||||||
(kEnd))))
|
|
||||||
|
|
||||||
===
|
|
||||||
for loop
|
|
||||||
===
|
|
||||||
|
|
||||||
procedure Main;
|
|
||||||
begin
|
|
||||||
for i := a to b do
|
|
||||||
c;
|
|
||||||
|
|
||||||
for i := a to b do
|
|
||||||
begin
|
|
||||||
c;
|
|
||||||
end;
|
|
||||||
|
|
||||||
for i := a downto b do
|
|
||||||
c;
|
|
||||||
|
|
||||||
for i := a downto b do
|
|
||||||
begin
|
|
||||||
c;
|
|
||||||
end;
|
|
||||||
|
|
||||||
for i in a do
|
|
||||||
c;
|
|
||||||
|
|
||||||
for i in a do
|
|
||||||
begin
|
|
||||||
c;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
(root
|
|
||||||
(defProc
|
|
||||||
(declProc (kProcedure) (identifier))
|
|
||||||
(block
|
|
||||||
(kBegin)
|
|
||||||
(for (kFor) (assignment (identifier) (kAssign) (identifier)) (kTo) (identifier) (kDo)
|
|
||||||
(statement (identifier)))
|
|
||||||
(for (kFor) (assignment (identifier) (kAssign) (identifier)) (kTo) (identifier) (kDo)
|
|
||||||
(block
|
|
||||||
(kBegin)
|
|
||||||
(statement
|
|
||||||
(identifier))
|
|
||||||
(kEnd)))
|
|
||||||
(for (kFor) (assignment (identifier) (kAssign) (identifier)) (kDownto) (identifier) (kDo)
|
|
||||||
(statement (identifier)))
|
|
||||||
(for (kFor) (assignment (identifier) (kAssign) (identifier)) (kDownto) (identifier) (kDo)
|
|
||||||
(block
|
|
||||||
(kBegin)
|
|
||||||
(statement (identifier))
|
|
||||||
(kEnd)))
|
|
||||||
(foreach (kFor) (identifier) (kIn) (identifier) (kDo)
|
|
||||||
(statement (identifier)))
|
|
||||||
(foreach (kFor) (identifier) (kIn) (identifier) (kDo)
|
|
||||||
(block
|
|
||||||
(kBegin)
|
|
||||||
(statement (identifier))
|
|
||||||
(kEnd)))
|
|
||||||
(kEnd))))
|
|
||||||
|
|
||||||
===
|
|
||||||
case of
|
|
||||||
===
|
|
||||||
|
|
||||||
procedure Main;
|
|
||||||
begin
|
|
||||||
case a of
|
|
||||||
b: c;
|
|
||||||
end;
|
|
||||||
|
|
||||||
case a of
|
|
||||||
b: c;
|
|
||||||
c: d;
|
|
||||||
else
|
|
||||||
e;
|
|
||||||
end;
|
|
||||||
|
|
||||||
case a of
|
|
||||||
b, c: d;
|
|
||||||
end;
|
|
||||||
|
|
||||||
case a of
|
|
||||||
b .. c: d;
|
|
||||||
end;
|
|
||||||
|
|
||||||
case a of
|
|
||||||
b .. c, d: e;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
(root
|
|
||||||
(defProc
|
|
||||||
(declProc (kProcedure) (identifier))
|
|
||||||
(block
|
|
||||||
(kBegin)
|
|
||||||
(case (kCase) (identifier) (kOf)
|
|
||||||
(caseCase
|
|
||||||
(caseLabel (identifier))
|
|
||||||
(statement (identifier)))
|
|
||||||
(kEnd))
|
|
||||||
(case (kCase) (identifier) (kOf)
|
|
||||||
(caseCase
|
|
||||||
(caseLabel (identifier))
|
|
||||||
(statement (identifier)))
|
|
||||||
(caseCase
|
|
||||||
(caseLabel (identifier))
|
|
||||||
(statement (identifier)))
|
|
||||||
(kElse)
|
|
||||||
(statement (identifier))
|
|
||||||
(kEnd))
|
|
||||||
(case (kCase) (identifier) (kOf)
|
|
||||||
(caseCase
|
|
||||||
(caseLabel (identifier) (identifier))
|
|
||||||
(statement (identifier)))
|
|
||||||
(kEnd))
|
|
||||||
(case (kCase) (identifier) (kOf)
|
|
||||||
(caseCase
|
|
||||||
(caseLabel (range (identifier) (identifier)))
|
|
||||||
(statement (identifier)))
|
|
||||||
(kEnd))
|
|
||||||
(case (kCase) (identifier) (kOf)
|
|
||||||
(caseCase
|
|
||||||
(caseLabel
|
|
||||||
(range (identifier) (identifier))
|
|
||||||
(identifier))
|
|
||||||
(statement (identifier)))
|
|
||||||
(kEnd))
|
|
||||||
(kEnd))))
|
|
||||||
|
|
||||||
===
|
|
||||||
try
|
|
||||||
===
|
|
||||||
|
|
||||||
procedure Main;
|
|
||||||
begin
|
|
||||||
|
|
||||||
try
|
|
||||||
a;
|
|
||||||
finally
|
|
||||||
b;
|
|
||||||
end;
|
|
||||||
|
|
||||||
try
|
|
||||||
a;
|
|
||||||
except
|
|
||||||
b;
|
|
||||||
end;
|
|
||||||
|
|
||||||
try
|
|
||||||
a;
|
|
||||||
except
|
|
||||||
on b: c do
|
|
||||||
d;
|
|
||||||
on e: f do
|
|
||||||
g;
|
|
||||||
else
|
|
||||||
h;
|
|
||||||
end;
|
|
||||||
|
|
||||||
end;
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
(root
|
|
||||||
(defProc
|
|
||||||
(declProc (kProcedure) (identifier))
|
|
||||||
(block
|
|
||||||
(kBegin)
|
|
||||||
(try (kTry)
|
|
||||||
(statements
|
|
||||||
(statement (identifier)))
|
|
||||||
(kFinally)
|
|
||||||
(statements
|
|
||||||
(statement (identifier)))
|
|
||||||
(kEnd))
|
|
||||||
(try (kTry)
|
|
||||||
(statements
|
|
||||||
(statement (identifier)))
|
|
||||||
(kExcept)
|
|
||||||
(statements
|
|
||||||
(statement (identifier)))
|
|
||||||
(kEnd))
|
|
||||||
(try (kTry)
|
|
||||||
(statements
|
|
||||||
(statement (identifier)))
|
|
||||||
(kExcept)
|
|
||||||
(exceptionHandler
|
|
||||||
(kOn) (identifier) (typeref (identifier)) (kDo)
|
|
||||||
(statement (identifier)))
|
|
||||||
(exceptionHandler
|
|
||||||
(kOn) (identifier) (typeref (identifier)) (kDo)
|
|
||||||
(statement (identifier)))
|
|
||||||
(exceptionElse (kElse)
|
|
||||||
(statement (identifier)))
|
|
||||||
(kEnd))
|
|
||||||
(kEnd))))
|
|
||||||
|
|
||||||
===
|
|
||||||
with
|
|
||||||
===
|
|
||||||
|
|
||||||
procedure Main;
|
|
||||||
begin
|
|
||||||
with a do
|
|
||||||
b;
|
|
||||||
|
|
||||||
with a do
|
|
||||||
begin
|
|
||||||
b;
|
|
||||||
end;
|
|
||||||
|
|
||||||
with a, b do
|
|
||||||
c;
|
|
||||||
end;
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
(root
|
|
||||||
(defProc
|
|
||||||
(declProc (kProcedure) (identifier))
|
|
||||||
(block
|
|
||||||
(kBegin)
|
|
||||||
(with (kWith) (identifier) (kDo)
|
|
||||||
(statement (identifier)))
|
|
||||||
(with
|
|
||||||
(kWith) (identifier) (kDo)
|
|
||||||
(block
|
|
||||||
(kBegin)
|
|
||||||
(statement (identifier))
|
|
||||||
(kEnd)))
|
|
||||||
(with (kWith) (identifier) (identifier) (kDo)
|
|
||||||
(statement (identifier)))
|
|
||||||
(kEnd))))
|
|
||||||
|
|
||||||
===
|
|
||||||
asm
|
|
||||||
===
|
|
||||||
|
|
||||||
procedure Main;
|
|
||||||
begin
|
|
||||||
asm
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
(root
|
|
||||||
(defProc
|
|
||||||
(declProc (kProcedure) (identifier))
|
|
||||||
(block
|
|
||||||
(kBegin)
|
|
||||||
(asm
|
|
||||||
(kAsm)
|
|
||||||
(kEnd))
|
|
||||||
(kEnd))))
|
|
||||||
|
|
||||||
===
|
|
||||||
raise
|
|
||||||
===
|
|
||||||
|
|
||||||
procedure Main;
|
|
||||||
begin
|
|
||||||
raise a;
|
|
||||||
end;
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
(root
|
|
||||||
(defProc
|
|
||||||
(declProc (kProcedure) (identifier))
|
|
||||||
(block
|
|
||||||
(kBegin)
|
|
||||||
(raise (kRaise) (identifier))
|
|
||||||
(kEnd))))
|
|
||||||
|
|
||||||
===
|
|
||||||
goto + label
|
|
||||||
===
|
|
||||||
|
|
||||||
procedure Main;
|
|
||||||
begin
|
|
||||||
a:;
|
|
||||||
goto a;
|
|
||||||
end;
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
(root
|
|
||||||
(defProc
|
|
||||||
(declProc (kProcedure) (identifier))
|
|
||||||
(block
|
|
||||||
(kBegin)
|
|
||||||
(label (identifier))
|
|
||||||
(goto (kGoto) (identifier))
|
|
||||||
(kEnd))))
|
|
||||||
|
|
||||||
===
|
|
||||||
assignment
|
|
||||||
===
|
|
||||||
|
|
||||||
procedure Main;
|
|
||||||
begin
|
|
||||||
a := b;
|
|
||||||
end;
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
(root
|
|
||||||
(defProc
|
|
||||||
(declProc (kProcedure) (identifier))
|
|
||||||
(block
|
|
||||||
(kBegin)
|
|
||||||
(assignment (identifier) (kAssign) (identifier))
|
|
||||||
(kEnd))))
|
|
||||||
|
|
||||||
===
|
|
||||||
trailing
|
|
||||||
===
|
|
||||||
|
|
||||||
procedure Main();
|
|
||||||
begin
|
|
||||||
begin
|
|
||||||
a;
|
|
||||||
b
|
|
||||||
end;
|
|
||||||
|
|
||||||
begin
|
|
||||||
begin
|
|
||||||
end
|
|
||||||
end;
|
|
||||||
|
|
||||||
begin
|
|
||||||
if a then
|
|
||||||
b
|
|
||||||
end;
|
|
||||||
|
|
||||||
begin
|
|
||||||
if a then
|
|
||||||
if b then
|
|
||||||
c
|
|
||||||
end;
|
|
||||||
|
|
||||||
begin
|
|
||||||
if a then
|
|
||||||
begin
|
|
||||||
b
|
|
||||||
end
|
|
||||||
end;
|
|
||||||
|
|
||||||
begin
|
|
||||||
if a then
|
|
||||||
b
|
|
||||||
else
|
|
||||||
c
|
|
||||||
end;
|
|
||||||
|
|
||||||
begin
|
|
||||||
if a then
|
|
||||||
begin
|
|
||||||
b
|
|
||||||
end
|
|
||||||
else
|
|
||||||
begin
|
|
||||||
c
|
|
||||||
end
|
|
||||||
end;
|
|
||||||
|
|
||||||
begin
|
|
||||||
while a do
|
|
||||||
b
|
|
||||||
end;
|
|
||||||
|
|
||||||
begin
|
|
||||||
repeat
|
|
||||||
a
|
|
||||||
until b
|
|
||||||
end;
|
|
||||||
|
|
||||||
begin
|
|
||||||
for a := b to c do
|
|
||||||
a
|
|
||||||
end;
|
|
||||||
|
|
||||||
begin
|
|
||||||
for a := b to c do
|
|
||||||
begin
|
|
||||||
a
|
|
||||||
end
|
|
||||||
end;
|
|
||||||
|
|
||||||
begin
|
|
||||||
case a of
|
|
||||||
b: c;
|
|
||||||
d: e
|
|
||||||
end
|
|
||||||
end;
|
|
||||||
|
|
||||||
begin
|
|
||||||
case a of
|
|
||||||
b: c;
|
|
||||||
else
|
|
||||||
d
|
|
||||||
end
|
|
||||||
end;
|
|
||||||
|
|
||||||
begin
|
|
||||||
try
|
|
||||||
a
|
|
||||||
finally
|
|
||||||
b
|
|
||||||
end
|
|
||||||
end;
|
|
||||||
|
|
||||||
begin
|
|
||||||
try
|
|
||||||
a
|
|
||||||
except
|
|
||||||
b
|
|
||||||
end
|
|
||||||
end;
|
|
||||||
|
|
||||||
begin
|
|
||||||
with a do
|
|
||||||
b
|
|
||||||
end;
|
|
||||||
|
|
||||||
begin
|
|
||||||
a := b
|
|
||||||
end;
|
|
||||||
|
|
||||||
begin
|
|
||||||
goto a
|
|
||||||
end;
|
|
||||||
|
|
||||||
end;
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
(root
|
|
||||||
(defProc
|
|
||||||
(declProc (kProcedure) (identifier) (declArgs))
|
|
||||||
(block
|
|
||||||
(kBegin)
|
|
||||||
(block
|
|
||||||
(kBegin)
|
|
||||||
(statement (identifier))
|
|
||||||
(statement (identifier))
|
|
||||||
(kEnd))
|
|
||||||
(block
|
|
||||||
(kBegin)
|
|
||||||
(block
|
|
||||||
(kBegin)
|
|
||||||
(kEnd))
|
|
||||||
(kEnd))
|
|
||||||
(block
|
|
||||||
(kBegin)
|
|
||||||
(if (kIf) (identifier) (kThen)
|
|
||||||
(statement (identifier)))
|
|
||||||
(kEnd))
|
|
||||||
(block
|
|
||||||
(kBegin)
|
|
||||||
(if (kIf) (identifier) (kThen)
|
|
||||||
(if (kIf) (identifier) (kThen)
|
|
||||||
(statement (identifier))))
|
|
||||||
(kEnd))
|
|
||||||
(block
|
|
||||||
(kBegin)
|
|
||||||
(if (kIf) (identifier) (kThen)
|
|
||||||
(block
|
|
||||||
(kBegin)
|
|
||||||
(statement (identifier))
|
|
||||||
(kEnd)))
|
|
||||||
(kEnd))
|
|
||||||
(block
|
|
||||||
(kBegin)
|
|
||||||
(ifElse (kIf) (identifier) (kThen)
|
|
||||||
(statement (identifier))
|
|
||||||
(kElse)
|
|
||||||
(statement (identifier)))
|
|
||||||
(kEnd))
|
|
||||||
(block
|
|
||||||
(kBegin)
|
|
||||||
(ifElse (kIf) (identifier) (kThen)
|
|
||||||
(block
|
|
||||||
(kBegin)
|
|
||||||
(statement (identifier))
|
|
||||||
(kEnd))
|
|
||||||
(kElse)
|
|
||||||
(block
|
|
||||||
(kBegin)
|
|
||||||
(statement (identifier))
|
|
||||||
(kEnd)))
|
|
||||||
(kEnd))
|
|
||||||
(block
|
|
||||||
(kBegin)
|
|
||||||
(while (kWhile) (identifier) (kDo)
|
|
||||||
(statement (identifier)))
|
|
||||||
(kEnd))
|
|
||||||
(block
|
|
||||||
(kBegin)
|
|
||||||
(repeat (kRepeat)
|
|
||||||
(statements
|
|
||||||
(statement (identifier)))
|
|
||||||
(kUntil)
|
|
||||||
(identifier))
|
|
||||||
(kEnd))
|
|
||||||
(block
|
|
||||||
(kBegin)
|
|
||||||
(for (kFor) (assignment (identifier) (kAssign) (identifier)) (kTo) (identifier) (kDo)
|
|
||||||
(statement (identifier)))
|
|
||||||
(kEnd))
|
|
||||||
(block
|
|
||||||
(kBegin)
|
|
||||||
(for (kFor) (assignment (identifier) (kAssign) (identifier)) (kTo) (identifier) (kDo)
|
|
||||||
(block
|
|
||||||
(kBegin)
|
|
||||||
(statement (identifier))
|
|
||||||
(kEnd)))
|
|
||||||
(kEnd))
|
|
||||||
(block
|
|
||||||
(kBegin)
|
|
||||||
(case (kCase) (identifier) (kOf)
|
|
||||||
(caseCase
|
|
||||||
(caseLabel (identifier))
|
|
||||||
(statement (identifier)))
|
|
||||||
(caseCase
|
|
||||||
(caseLabel (identifier))
|
|
||||||
(statement (identifier)))
|
|
||||||
(kEnd))
|
|
||||||
(kEnd))
|
|
||||||
(block
|
|
||||||
(kBegin)
|
|
||||||
(case (kCase) (identifier) (kOf)
|
|
||||||
(caseCase
|
|
||||||
(caseLabel (identifier))
|
|
||||||
(statement (identifier)))
|
|
||||||
(kElse)
|
|
||||||
(statement (identifier))
|
|
||||||
(kEnd))
|
|
||||||
(kEnd))
|
|
||||||
(block
|
|
||||||
(kBegin)
|
|
||||||
(try
|
|
||||||
(kTry)
|
|
||||||
(statements
|
|
||||||
(statement (identifier)))
|
|
||||||
(kFinally)
|
|
||||||
(statements
|
|
||||||
(statement (identifier)))
|
|
||||||
(kEnd))
|
|
||||||
(kEnd))
|
|
||||||
(block
|
|
||||||
(kBegin)
|
|
||||||
(try
|
|
||||||
(kTry)
|
|
||||||
(statements
|
|
||||||
(statement (identifier)))
|
|
||||||
(kExcept)
|
|
||||||
(statements
|
|
||||||
(statement (identifier)))
|
|
||||||
(kEnd))
|
|
||||||
(kEnd))
|
|
||||||
(block
|
|
||||||
(kBegin)
|
|
||||||
(with (kWith) (identifier) (kDo)
|
|
||||||
(statement (identifier)))
|
|
||||||
(kEnd))
|
|
||||||
(block
|
|
||||||
(kBegin)
|
|
||||||
(assignment (identifier) (kAssign) (identifier))
|
|
||||||
(kEnd))
|
|
||||||
(block
|
|
||||||
(kBegin)
|
|
||||||
(goto (kGoto) (identifier))
|
|
||||||
(kEnd))
|
|
||||||
(kEnd))))
|
|
||||||
Loading…
Reference in New Issue