github.com/hirochachacha/plua@v0.0.0-20170217012138-c82f520cc725/compiler/ast/printer/testdata/example.lua (about)

     1  if true then -- comment1
     2  print("x")	-- comment2
     3  print("yyyy") -- comment3
     4  elseif true then      -- comment4
     5  print("y")-- comment5
     6  print("xxxxxxxx")	-- comment6
     7  else -- comment7
     8  -- comment8
     9  	-- comment9
    10  	print("xxxx") -- comment 10
    11  	print("xx") -- comment 11
    12  end
    13  
    14  -- fake
    15     -- art
    16     --[[
    17   fake
    18   man
    19   ]]
    20  
    21  -- TODO
    22  -- x = 1 + -- bar
    23  -- 4 + 9 -- foo
    24  -- + 10 -- baz
    25  
    26  x = x + 5 * 9 - 10 / 5 - - 5
    27  x = x + (5 - 1+9) * 6
    28  x = 1 - - 5, 9
    29  
    30  if ((x ~= 10) == true) then
    31  	print(x)
    32  end
    33  
    34  print(      "hello"     .."world")
    35  print("hello"..     "world",    "hello"     .."world")
    36  print(1+  7)
    37  print(1+  7, 1  +8)
    38  
    39  y = foo[  x +  5  ] + 8
    40  
    41  t = { [ 5 + 9 ] = y ,   11  }
    42  
    43  local foo
    44  
    45  x = 10 y = 24
    46  
    47  t = { --xxx
    48  	1, -- foo
    49  81111111 -- bar
    50  } -- aaa
    51  
    52  t =
    53  {
    54  	11111,
    55  	[5] = 011,
    56  }
    57  
    58  t = {
    59  	x = {
    60  		y =
    61  		{
    62  			z = 9
    63  		}
    64  	}
    65  }
    66  
    67  x{
    68  }
    69  
    70  print('\'test')
    71  
    72  foo = 5 .. 1 > "21"
    73  
    74  fn({
    75  	1,
    76  	9,
    77  })
    78  
    79  fn(function()
    80    return 1
    81  end)
    82  
    83  return ((x)+1)