===
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)))))

