Class: ReVIEW::Compiler

Inherits:
Object show all
Includes:
ReVIEWConstruction
Defined in:
lib/review/compiler.rb

Defined Under Namespace

Classes: Error, InlineSyntaxElement, MemoEntry, ParseError, Position, RuleInfo, SyntaxElement

Constant Summary collapse

SYNTAX =
{}
INLINE =
{}
COMPLEX_INLINE =
{}
Rules =
{}

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from ReVIEWConstruction

#block_element, #brace, #bracket_arg, #code_block_element, #column, #complex_inline_element, #complex_inline_element_content, #dlist, #dlist_element, #document, #headline, #inline_element, #inline_element_content, #newline, #olist, #olist_element, #paragraph, #raw, #singleline_comment, #singleline_content, #text, #ulist, #ulist_element

Constructor Details

#initialize(strategy) ⇒ Compiler

redifine Compiler.new



8
9
10
# File 'lib/review/compiler.rb', line 8

def initialize(str, debug=false)
  setup_parser(str, debug)
end

Instance Attribute Details

#failed_ruleObject (readonly)

Returns the value of attribute failed_rule.



169
170
171
# File 'lib/review/compiler.rb', line 169

def failed_rule
  @failed_rule
end

#failing_rule_offsetObject (readonly)

Returns the value of attribute failing_rule_offset.



27
28
29
# File 'lib/review/compiler.rb', line 27

def failing_rule_offset
  @failing_rule_offset
end

#posObject

Returns the value of attribute pos.



28
29
30
# File 'lib/review/compiler.rb', line 28

def pos
  @pos
end

#resultObject

Returns the value of attribute result.



28
29
30
# File 'lib/review/compiler.rb', line 28

def result
  @result
end

#strategyObject

Returns the value of attribute strategy.



402
403
404
# File 'lib/review/compiler.rb', line 402

def strategy
  @strategy
end

#stringObject (readonly)

Returns the value of attribute string.



26
27
28
# File 'lib/review/compiler.rb', line 26

def string
  @string
end

Class Method Details

.defblock(name, argc, optional = false, esc = nil, &block) ⇒ Object



526
527
528
# File 'lib/review/compiler.rb', line 526

def self.defblock(name, argc, optional = false, esc = nil, &block)
  defsyntax(name, (optional ? :optional : :block), argc, esc, &block)
end

.defcodeblock(name, argc, optional = false, esc = nil, &block) ⇒ Object



530
531
532
# File 'lib/review/compiler.rb', line 530

def self.defcodeblock(name, argc, optional = false, esc = nil, &block)
  defsyntax(name, (optional ? :optional_code_block : :code_block), argc, esc, &block)
end

.defcomplexinline(name) ⇒ Object



565
566
567
# File 'lib/review/compiler.rb', line 565

def self.defcomplexinline(name)
  COMPLEX_INLINE[name] = InlineSyntaxElement.new(name)
end

.definline(name) ⇒ Object



561
562
563
# File 'lib/review/compiler.rb', line 561

def self.definline(name)
  INLINE[name] = InlineSyntaxElement.new(name)
end

.defsingle(name, argc, esc = nil, &block) ⇒ Object



534
535
536
# File 'lib/review/compiler.rb', line 534

def self.defsingle(name, argc, esc = nil, &block)
  defsyntax name, :line, argc, esc, &block
end

.defsyntax(name, type, argc, esc = nil, &block) ⇒ Object



538
539
540
# File 'lib/review/compiler.rb', line 538

def self.defsyntax(name, type, argc, esc = nil, &block)
  SYNTAX[name] = SyntaxElement.new(name, type, argc, esc, &block)
end

.rule_info(name, rendered) ⇒ Object



367
368
369
# File 'lib/review/compiler.rb', line 367

def self.rule_info(name, rendered)
  RuleInfo.new(name, rendered)
end

Instance Method Details

#_AlphanumericAsciiObject

AlphanumericAscii = /[A-Za-z0-9]/



5054
5055
5056
5057
5058
# File 'lib/review/compiler.rb', line 5054

def _AlphanumericAscii
  _tmp = scan(/\A(?-mix:[A-Za-z0-9])/)
  set_failed_rule :_AlphanumericAscii unless _tmp
  return _tmp
end

#_BlankLineObject

BlankLine = Newline



1373
1374
1375
1376
1377
# File 'lib/review/compiler.rb', line 1373

def _BlankLine
  _tmp = apply(:_Newline)
  set_failed_rule :_BlankLine unless _tmp
  return _tmp
end

#_BlockObject

Block = BlankLine*:c { c } (SinglelineComment:c | Headline:c | BlockElement:c | Ulist:c | Olist:c | Dlist:c | Paragraph:c) { c }



1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
# File 'lib/review/compiler.rb', line 1299

def _Block

  _save = self.pos
  while true # sequence
    _ary = []
    while true
      _tmp = apply(:_BlankLine)
      _ary << @result if _tmp
      break unless _tmp
    end
    _tmp = true
    @result = _ary
    c = @result
    unless _tmp
      self.pos = _save
      break
    end
    @result = begin;  c ; end
    _tmp = true
    unless _tmp
      self.pos = _save
      break
    end

    _save2 = self.pos
    while true # choice
      _tmp = apply(:_SinglelineComment)
      c = @result
      break if _tmp
      self.pos = _save2
      _tmp = apply(:_Headline)
      c = @result
      break if _tmp
      self.pos = _save2
      _tmp = apply(:_BlockElement)
      c = @result
      break if _tmp
      self.pos = _save2
      _tmp = apply(:_Ulist)
      c = @result
      break if _tmp
      self.pos = _save2
      _tmp = apply(:_Olist)
      c = @result
      break if _tmp
      self.pos = _save2
      _tmp = apply(:_Dlist)
      c = @result
      break if _tmp
      self.pos = _save2
      _tmp = apply(:_Paragraph)
      c = @result
      break if _tmp
      self.pos = _save2
      break
    end # end choice

    unless _tmp
      self.pos = _save
      break
    end
    @result = begin;  c ; end
    _tmp = true
    unless _tmp
      self.pos = _save
    end
    break
  end # end sequence

  set_failed_rule :_Block unless _tmp
  return _tmp
end

#_BlockElementObject

BlockElement = (“//raw[” RawBlockBuilderSelect?:b RawBlockElementArg*:r1 “]” Space* EOL b, position, r1) | !“//raw” “//” ElementName:symbol &{ syntax = syntax_descriptor(symbol); syntax && syntax.code_block? } BracketArg*:args “Space* Newline CodeBlockElementContents?:contents “//” Space* EOL position, symbol, args, contents) | !“//raw” “//” ElementName:symbol BracketArg*:args “Space* Newline BlockElementContents?:contents “//” Space* EOL position, symbol, args, contents) | !“//raw” “//” ElementName:symbol BracketArg*:args Space* EOL position, symbol, args, nil))



1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
# File 'lib/review/compiler.rb', line 1638

def _BlockElement

  _save = self.pos
  while true # choice

    _save1 = self.pos
    while true # sequence
      _tmp = match_string("//raw[")
      unless _tmp
        self.pos = _save1
        break
      end
      _save2 = self.pos
      _tmp = apply(:_RawBlockBuilderSelect)
      @result = nil unless _tmp
      unless _tmp
        _tmp = true
        self.pos = _save2
      end
      b = @result
      unless _tmp
        self.pos = _save1
        break
      end
      _ary = []
      while true
        _tmp = apply(:_RawBlockElementArg)
        _ary << @result if _tmp
        break unless _tmp
      end
      _tmp = true
      @result = _ary
      r1 = @result
      unless _tmp
        self.pos = _save1
        break
      end
      _tmp = match_string("]")
      unless _tmp
        self.pos = _save1
        break
      end
      while true
        _tmp = apply(:_Space)
        break unless _tmp
      end
      _tmp = true
      unless _tmp
        self.pos = _save1
        break
      end
      _tmp = apply(:_EOL)
      unless _tmp
        self.pos = _save1
        break
      end
      @result = begin; raw(self, b, position, r1); end
      _tmp = true
      unless _tmp
        self.pos = _save1
      end
      break
    end # end sequence

    break if _tmp
    self.pos = _save

    _save5 = self.pos
    while true # sequence
      _save6 = self.pos
      _tmp = match_string("//raw")
      _tmp = _tmp ? nil : true
      self.pos = _save6
      unless _tmp
        self.pos = _save5
        break
      end
      _tmp = match_string("//")
      unless _tmp
        self.pos = _save5
        break
      end
      _tmp = apply(:_ElementName)
      symbol = @result
      unless _tmp
        self.pos = _save5
        break
      end
      _save7 = self.pos
      _tmp = begin;  syntax = syntax_descriptor(symbol); syntax && syntax.code_block? ; end
      self.pos = _save7
      unless _tmp
        self.pos = _save5
        break
      end
      _ary = []
      while true
        _tmp = apply(:_BracketArg)
        _ary << @result if _tmp
        break unless _tmp
      end
      _tmp = true
      @result = _ary
      args = @result
      unless _tmp
        self.pos = _save5
        break
      end
      _tmp = match_string("{")
      unless _tmp
        self.pos = _save5
        break
      end
      while true
        _tmp = apply(:_Space)
        break unless _tmp
      end
      _tmp = true
      unless _tmp
        self.pos = _save5
        break
      end
      _tmp = apply(:_Newline)
      unless _tmp
        self.pos = _save5
        break
      end
      _save10 = self.pos
      _tmp = apply(:_CodeBlockElementContents)
      @result = nil unless _tmp
      unless _tmp
        _tmp = true
        self.pos = _save10
      end
      contents = @result
      unless _tmp
        self.pos = _save5
        break
      end
      _tmp = match_string("//}")
      unless _tmp
        self.pos = _save5
        break
      end
      while true
        _tmp = apply(:_Space)
        break unless _tmp
      end
      _tmp = true
      unless _tmp
        self.pos = _save5
        break
      end
      _tmp = apply(:_EOL)
      unless _tmp
        self.pos = _save5
        break
      end
      @result = begin; code_block_element(self, position, symbol, args, contents); end
      _tmp = true
      unless _tmp
        self.pos = _save5
      end
      break
    end # end sequence

    break if _tmp
    self.pos = _save

    _save12 = self.pos
    while true # sequence
      _save13 = self.pos
      _tmp = match_string("//raw")
      _tmp = _tmp ? nil : true
      self.pos = _save13
      unless _tmp
        self.pos = _save12
        break
      end
      _tmp = match_string("//")
      unless _tmp
        self.pos = _save12
        break
      end
      _tmp = apply(:_ElementName)
      symbol = @result
      unless _tmp
        self.pos = _save12
        break
      end
      _ary = []
      while true
        _tmp = apply(:_BracketArg)
        _ary << @result if _tmp
        break unless _tmp
      end
      _tmp = true
      @result = _ary
      args = @result
      unless _tmp
        self.pos = _save12
        break
      end
      _tmp = match_string("{")
      unless _tmp
        self.pos = _save12
        break
      end
      while true
        _tmp = apply(:_Space)
        break unless _tmp
      end
      _tmp = true
      unless _tmp
        self.pos = _save12
        break
      end
      _tmp = apply(:_Newline)
      unless _tmp
        self.pos = _save12
        break
      end
      _save16 = self.pos
      _tmp = apply(:_BlockElementContents)
      @result = nil unless _tmp
      unless _tmp
        _tmp = true
        self.pos = _save16
      end
      contents = @result
      unless _tmp
        self.pos = _save12
        break
      end
      _tmp = match_string("//}")
      unless _tmp
        self.pos = _save12
        break
      end
      while true
        _tmp = apply(:_Space)
        break unless _tmp
      end
      _tmp = true
      unless _tmp
        self.pos = _save12
        break
      end
      _tmp = apply(:_EOL)
      unless _tmp
        self.pos = _save12
        break
      end
      @result = begin; block_element(self, position, symbol, args, contents); end
      _tmp = true
      unless _tmp
        self.pos = _save12
      end
      break
    end # end sequence

    break if _tmp
    self.pos = _save

    _save18 = self.pos
    while true # sequence
      _save19 = self.pos
      _tmp = match_string("//raw")
      _tmp = _tmp ? nil : true
      self.pos = _save19
      unless _tmp
        self.pos = _save18
        break
      end
      _tmp = match_string("//")
      unless _tmp
        self.pos = _save18
        break
      end
      _tmp = apply(:_ElementName)
      symbol = @result
      unless _tmp
        self.pos = _save18
        break
      end
      _ary = []
      while true
        _tmp = apply(:_BracketArg)
        _ary << @result if _tmp
        break unless _tmp
      end
      _tmp = true
      @result = _ary
      args = @result
      unless _tmp
        self.pos = _save18
        break
      end
      while true
        _tmp = apply(:_Space)
        break unless _tmp
      end
      _tmp = true
      unless _tmp
        self.pos = _save18
        break
      end
      _tmp = apply(:_EOL)
      unless _tmp
        self.pos = _save18
        break
      end
      @result = begin; block_element(self, position, symbol, args, nil); end
      _tmp = true
      unless _tmp
        self.pos = _save18
      end
      break
    end # end sequence

    break if _tmp
    self.pos = _save
    break
  end # end choice

  set_failed_rule :_BlockElement unless _tmp
  return _tmp
end

#_BlockElementContentObject

BlockElementContent = (SinglelineComment:c { c } | BlockElement:c { c } | Ulist:c | Dlist:c | Olist:c | BlankLine:c { c } | BlockElementParagraph:c { c })



2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
# File 'lib/review/compiler.rb', line 2415

def _BlockElementContent

  _save = self.pos
  while true # choice

    _save1 = self.pos
    while true # sequence
      _tmp = apply(:_SinglelineComment)
      c = @result
      unless _tmp
        self.pos = _save1
        break
      end
      @result = begin;  c ; end
      _tmp = true
      unless _tmp
        self.pos = _save1
      end
      break
    end # end sequence

    break if _tmp
    self.pos = _save

    _save2 = self.pos
    while true # sequence
      _tmp = apply(:_BlockElement)
      c = @result
      unless _tmp
        self.pos = _save2
        break
      end
      @result = begin;  c ; end
      _tmp = true
      unless _tmp
        self.pos = _save2
      end
      break
    end # end sequence

    break if _tmp
    self.pos = _save
    _tmp = apply(:_Ulist)
    c = @result
    break if _tmp
    self.pos = _save
    _tmp = apply(:_Dlist)
    c = @result
    break if _tmp
    self.pos = _save
    _tmp = apply(:_Olist)
    c = @result
    break if _tmp
    self.pos = _save

    _save3 = self.pos
    while true # sequence
      _tmp = apply(:_BlankLine)
      c = @result
      unless _tmp
        self.pos = _save3
        break
      end
      @result = begin;  c ; end
      _tmp = true
      unless _tmp
        self.pos = _save3
      end
      break
    end # end sequence

    break if _tmp
    self.pos = _save

    _save4 = self.pos
    while true # sequence
      _tmp = apply(:_BlockElementParagraph)
      c = @result
      unless _tmp
        self.pos = _save4
        break
      end
      @result = begin;  c ; end
      _tmp = true
      unless _tmp
        self.pos = _save4
      end
      break
    end # end sequence

    break if _tmp
    self.pos = _save
    break
  end # end choice

  set_failed_rule :_BlockElementContent unless _tmp
  return _tmp
end

#_BlockElementContentsObject

BlockElementContents = BlockElementContent+:c { c }



2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
# File 'lib/review/compiler.rb', line 2378

def _BlockElementContents

  _save = self.pos
  while true # sequence
    _save1 = self.pos
    _ary = []
    _tmp = apply(:_BlockElementContent)
    if _tmp
      _ary << @result
      while true
        _tmp = apply(:_BlockElementContent)
        _ary << @result if _tmp
        break unless _tmp
      end
      _tmp = true
      @result = _ary
    else
      self.pos = _save1
    end
    c = @result
    unless _tmp
      self.pos = _save
      break
    end
    @result = begin;  c ; end
    _tmp = true
    unless _tmp
      self.pos = _save
    end
    break
  end # end sequence

  set_failed_rule :_BlockElementContents unless _tmp
  return _tmp
end

#_BlockElementParagraphObject

BlockElementParagraph = BlockElementParagraphLine+:c position, c.flatten)



2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
# File 'lib/review/compiler.rb', line 2515

def _BlockElementParagraph

  _save = self.pos
  while true # sequence
    _save1 = self.pos
    _ary = []
    _tmp = apply(:_BlockElementParagraphLine)
    if _tmp
      _ary << @result
      while true
        _tmp = apply(:_BlockElementParagraphLine)
        _ary << @result if _tmp
        break unless _tmp
      end
      _tmp = true
      @result = _ary
    else
      self.pos = _save1
    end
    c = @result
    unless _tmp
      self.pos = _save
      break
    end
    @result = begin; paragraph(self, position, c.flatten); end
    _tmp = true
    unless _tmp
      self.pos = _save
    end
    break
  end # end sequence

  set_failed_rule :_BlockElementParagraph unless _tmp
  return _tmp
end

#_BlockElementParagraphLineObject

BlockElementParagraphLine = !“//}” !BlankLine !SinglelineComment !BlockElement !Ulist !Olist !Dlist SinglelineContent:c Newline { c }



2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
# File 'lib/review/compiler.rb', line 2552

def _BlockElementParagraphLine

  _save = self.pos
  while true # sequence
    _save1 = self.pos
    _tmp = match_string("//}")
    _tmp = _tmp ? nil : true
    self.pos = _save1
    unless _tmp
      self.pos = _save
      break
    end
    _save2 = self.pos
    _tmp = apply(:_BlankLine)
    _tmp = _tmp ? nil : true
    self.pos = _save2
    unless _tmp
      self.pos = _save
      break
    end
    _save3 = self.pos
    _tmp = apply(:_SinglelineComment)
    _tmp = _tmp ? nil : true
    self.pos = _save3
    unless _tmp
      self.pos = _save
      break
    end
    _save4 = self.pos
    _tmp = apply(:_BlockElement)
    _tmp = _tmp ? nil : true
    self.pos = _save4
    unless _tmp
      self.pos = _save
      break
    end
    _save5 = self.pos
    _tmp = apply(:_Ulist)
    _tmp = _tmp ? nil : true
    self.pos = _save5
    unless _tmp
      self.pos = _save
      break
    end
    _save6 = self.pos
    _tmp = apply(:_Olist)
    _tmp = _tmp ? nil : true
    self.pos = _save6
    unless _tmp
      self.pos = _save
      break
    end
    _save7 = self.pos
    _tmp = apply(:_Dlist)
    _tmp = _tmp ? nil : true
    self.pos = _save7
    unless _tmp
      self.pos = _save
      break
    end
    _tmp = apply(:_SinglelineContent)
    c = @result
    unless _tmp
      self.pos = _save
      break
    end
    _tmp = apply(:_Newline)
    unless _tmp
      self.pos = _save
      break
    end
    @result = begin;  c ; end
    _tmp = true
    unless _tmp
      self.pos = _save
    end
    break
  end # end sequence

  set_failed_rule :_BlockElementParagraphLine unless _tmp
  return _tmp
end

#_BOMObject

BOM = “uFEFF”



5075
5076
5077
5078
5079
# File 'lib/review/compiler.rb', line 5075

def _BOM
  _tmp = match_string("uFEFF")
  set_failed_rule :_BOM unless _tmp
  return _tmp
end

#_BraceArgObject

BraceArg = “< /([^rn\]|\[^rn])*/ > “}” { text }



2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
# File 'lib/review/compiler.rb', line 2342

def _BraceArg

  _save = self.pos
  while true # sequence
    _tmp = match_string("{")
    unless _tmp
      self.pos = _save
      break
    end
    _text_start = self.pos
    _tmp = scan(/\A(?-mix:([^\r\n}\\]|\\[^\r\n])*)/)
    if _tmp
      text = get_text(_text_start)
    end
    unless _tmp
      self.pos = _save
      break
    end
    _tmp = match_string("}")
    unless _tmp
      self.pos = _save
      break
    end
    @result = begin;  text ; end
    _tmp = true
    unless _tmp
      self.pos = _save
    end
    break
  end # end sequence

  set_failed_rule :_BraceArg unless _tmp
  return _tmp
end

#_BracketArgObject

BracketArg = “[” BracketArgInline*:content “]” position, content)



2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
# File 'lib/review/compiler.rb', line 2213

def _BracketArg

  _save = self.pos
  while true # sequence
    _tmp = match_string("[")
    unless _tmp
      self.pos = _save
      break
    end
    _ary = []
    while true
      _tmp = apply(:_BracketArgInline)
      _ary << @result if _tmp
      break unless _tmp
    end
    _tmp = true
    @result = _ary
    content = @result
    unless _tmp
      self.pos = _save
      break
    end
    _tmp = match_string("]")
    unless _tmp
      self.pos = _save
      break
    end
    @result = begin; bracket_arg(self, position, content); end
    _tmp = true
    unless _tmp
      self.pos = _save
    end
    break
  end # end sequence

  set_failed_rule :_BracketArg unless _tmp
  return _tmp
end

#_BracketArgInlineObject

BracketArgInline = (InlineElement:c { c } | “\]” position, “]”) | “\\” position, “\”) | < /[^rn]]/ > position, text))



2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
# File 'lib/review/compiler.rb', line 2253

def _BracketArgInline

  _save = self.pos
  while true # choice

    _save1 = self.pos
    while true # sequence
      _tmp = apply(:_InlineElement)
      c = @result
      unless _tmp
        self.pos = _save1
        break
      end
      @result = begin;  c ; end
      _tmp = true
      unless _tmp
        self.pos = _save1
      end
      break
    end # end sequence

    break if _tmp
    self.pos = _save

    _save2 = self.pos
    while true # sequence
      _tmp = match_string("\\]")
      unless _tmp
        self.pos = _save2
        break
      end
      @result = begin; text(self, position, "]"); end
      _tmp = true
      unless _tmp
        self.pos = _save2
      end
      break
    end # end sequence

    break if _tmp
    self.pos = _save

    _save3 = self.pos
    while true # sequence
      _tmp = match_string("\\\\")
      unless _tmp
        self.pos = _save3
        break
      end
      @result = begin; text(self, position, "\\"); end
      _tmp = true
      unless _tmp
        self.pos = _save3
      end
      break
    end # end sequence

    break if _tmp
    self.pos = _save

    _save4 = self.pos
    while true # sequence
      _text_start = self.pos
      _tmp = scan(/\A(?-mix:[^\r\n\]])/)
      if _tmp
        text = get_text(_text_start)
      end
      unless _tmp
        self.pos = _save4
        break
      end
      @result = begin; text(self, position, text); end
      _tmp = true
      unless _tmp
        self.pos = _save4
      end
      break
    end # end sequence

    break if _tmp
    self.pos = _save
    break
  end # end choice

  set_failed_rule :_BracketArgInline unless _tmp
  return _tmp
end

#_BulletObject

Bullet = “*”



2755
2756
2757
2758
2759
# File 'lib/review/compiler.rb', line 2755

def _Bullet
  _tmp = match_string("*")
  set_failed_rule :_Bullet unless _tmp
  return _tmp
end

#_CodeBlockElementContentObject

CodeBlockElementContent = (SinglelineComment:c { c } | BlankLine:c { ::ReVIEW::TextNode.new(self, position, “n”) } | !“//}” SinglelineContent:c Newline { [c, ::ReVIEW::TextNode.new(self, position, “n”)] })



2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
# File 'lib/review/compiler.rb', line 2673

def _CodeBlockElementContent

  _save = self.pos
  while true # choice

    _save1 = self.pos
    while true # sequence
      _tmp = apply(:_SinglelineComment)
      c = @result
      unless _tmp
        self.pos = _save1
        break
      end
      @result = begin;  c ; end
      _tmp = true
      unless _tmp
        self.pos = _save1
      end
      break
    end # end sequence

    break if _tmp
    self.pos = _save

    _save2 = self.pos
    while true # sequence
      _tmp = apply(:_BlankLine)
      c = @result
      unless _tmp
        self.pos = _save2
        break
      end
      @result = begin;  ::ReVIEW::TextNode.new(self, position, "\n") ; end
      _tmp = true
      unless _tmp
        self.pos = _save2
      end
      break
    end # end sequence

    break if _tmp
    self.pos = _save

    _save3 = self.pos
    while true # sequence
      _save4 = self.pos
      _tmp = match_string("//}")
      _tmp = _tmp ? nil : true
      self.pos = _save4
      unless _tmp
        self.pos = _save3
        break
      end
      _tmp = apply(:_SinglelineContent)
      c = @result
      unless _tmp
        self.pos = _save3
        break
      end
      _tmp = apply(:_Newline)
      unless _tmp
        self.pos = _save3
        break
      end
      @result = begin;  [c, ::ReVIEW::TextNode.new(self, position, "\n")] ; end
      _tmp = true
      unless _tmp
        self.pos = _save3
      end
      break
    end # end sequence

    break if _tmp
    self.pos = _save
    break
  end # end choice

  set_failed_rule :_CodeBlockElementContent unless _tmp
  return _tmp
end

#_CodeBlockElementContentsObject

CodeBlockElementContents = CodeBlockElementContent+:c { c }



2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
# File 'lib/review/compiler.rb', line 2636

def _CodeBlockElementContents

  _save = self.pos
  while true # sequence
    _save1 = self.pos
    _ary = []
    _tmp = apply(:_CodeBlockElementContent)
    if _tmp
      _ary << @result
      while true
        _tmp = apply(:_CodeBlockElementContent)
        _ary << @result if _tmp
        break unless _tmp
      end
      _tmp = true
      @result = _ary
    else
      self.pos = _save1
    end
    c = @result
    unless _tmp
      self.pos = _save
      break
    end
    @result = begin;  c ; end
    _tmp = true
    unless _tmp
      self.pos = _save
    end
    break
  end # end sequence

  set_failed_rule :_CodeBlockElementContents unless _tmp
  return _tmp
end

#_ComplexInlineElementContentsObject

ComplexInlineElementContents = !“}” ComplexInlineElementContentsSub:c { c }



4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
# File 'lib/review/compiler.rb', line 4401

def _ComplexInlineElementContents

  _save = self.pos
  while true # sequence
    _save1 = self.pos
    _tmp = match_string("}")
    _tmp = _tmp ? nil : true
    self.pos = _save1
    unless _tmp
      self.pos = _save
      break
    end
    _tmp = apply(:_ComplexInlineElementContentsSub)
    c = @result
    unless _tmp
      self.pos = _save
      break
    end
    @result = begin;  c ; end
    _tmp = true
    unless _tmp
      self.pos = _save
    end
    break
  end # end sequence

  set_failed_rule :_ComplexInlineElementContents unless _tmp
  return _tmp
end

#_ComplexInlineElementContentsSubObject

ComplexInlineElementContentsSub = !“}” (Space* InlineElementContent:c1 Space* “,” ComplexInlineElementContentsSub:c2 { [c1]+c2 } | Space* InlineElementContent:c1 Space* { [c1] })



4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
# File 'lib/review/compiler.rb', line 4432

def _ComplexInlineElementContentsSub

  _save = self.pos
  while true # sequence
    _save1 = self.pos
    _tmp = match_string("}")
    _tmp = _tmp ? nil : true
    self.pos = _save1
    unless _tmp
      self.pos = _save
      break
    end

    _save2 = self.pos
    while true # choice

      _save3 = self.pos
      while true # sequence
        while true
          _tmp = apply(:_Space)
          break unless _tmp
        end
        _tmp = true
        unless _tmp
          self.pos = _save3
          break
        end
        _tmp = apply(:_InlineElementContent)
        c1 = @result
        unless _tmp
          self.pos = _save3
          break
        end
        while true
          _tmp = apply(:_Space)
          break unless _tmp
        end
        _tmp = true
        unless _tmp
          self.pos = _save3
          break
        end
        _tmp = match_string(",")
        unless _tmp
          self.pos = _save3
          break
        end
        _tmp = apply(:_ComplexInlineElementContentsSub)
        c2 = @result
        unless _tmp
          self.pos = _save3
          break
        end
        @result = begin;   [c1]+c2 ; end
        _tmp = true
        unless _tmp
          self.pos = _save3
        end
        break
      end # end sequence

      break if _tmp
      self.pos = _save2

      _save6 = self.pos
      while true # sequence
        while true
          _tmp = apply(:_Space)
          break unless _tmp
        end
        _tmp = true
        unless _tmp
          self.pos = _save6
          break
        end
        _tmp = apply(:_InlineElementContent)
        c1 = @result
        unless _tmp
          self.pos = _save6
          break
        end
        while true
          _tmp = apply(:_Space)
          break unless _tmp
        end
        _tmp = true
        unless _tmp
          self.pos = _save6
          break
        end
        @result = begin;  [c1] ; end
        _tmp = true
        unless _tmp
          self.pos = _save6
        end
        break
      end # end sequence

      break if _tmp
      self.pos = _save2
      break
    end # end choice

    unless _tmp
      self.pos = _save
    end
    break
  end # end sequence

  set_failed_rule :_ComplexInlineElementContentsSub unless _tmp
  return _tmp
end

#_ComplexInlineElementSymbolObject

ComplexInlineElementSymbol = < AlphanumericAscii+ > &{ check_complex_inline_element_symbol(text) } { text }



4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
# File 'lib/review/compiler.rb', line 4358

def _ComplexInlineElementSymbol

  _save = self.pos
  while true # sequence
    _text_start = self.pos
    _save1 = self.pos
    _tmp = apply(:_AlphanumericAscii)
    if _tmp
      while true
        _tmp = apply(:_AlphanumericAscii)
        break unless _tmp
      end
      _tmp = true
    else
      self.pos = _save1
    end
    if _tmp
      text = get_text(_text_start)
    end
    unless _tmp
      self.pos = _save
      break
    end
    _save2 = self.pos
    _tmp = begin;  check_complex_inline_element_symbol(text) ; end
    self.pos = _save2
    unless _tmp
      self.pos = _save
      break
    end
    @result = begin;  text ; end
    _tmp = true
    unless _tmp
      self.pos = _save
    end
    break
  end # end sequence

  set_failed_rule :_ComplexInlineElementSymbol unless _tmp
  return _tmp
end

#_DigitObject

Digit = /[0-9]/



5068
5069
5070
5071
5072
# File 'lib/review/compiler.rb', line 5068

def _Digit
  _tmp = scan(/\A(?-mix:[0-9])/)
  set_failed_rule :_Digit unless _tmp
  return _tmp
end

#_DlistObject

Dlist = (DlistElement | SinglelineComment)+:content position, content)



3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
# File 'lib/review/compiler.rb', line 3679

def _Dlist

  _save = self.pos
  while true # sequence
    _save1 = self.pos
    _ary = []

    _save2 = self.pos
    while true # choice
      _tmp = apply(:_DlistElement)
      break if _tmp
      self.pos = _save2
      _tmp = apply(:_SinglelineComment)
      break if _tmp
      self.pos = _save2
      break
    end # end choice

    if _tmp
      _ary << @result
      while true

        _save3 = self.pos
        while true # choice
          _tmp = apply(:_DlistElement)
          break if _tmp
          self.pos = _save3
          _tmp = apply(:_SinglelineComment)
          break if _tmp
          self.pos = _save3
          break
        end # end choice

        _ary << @result if _tmp
        break unless _tmp
      end
      _tmp = true
      @result = _ary
    else
      self.pos = _save1
    end
    content = @result
    unless _tmp
      self.pos = _save
      break
    end
    @result = begin; dlist(self, position, content); end
    _tmp = true
    unless _tmp
      self.pos = _save
    end
    break
  end # end sequence

  set_failed_rule :_Dlist unless _tmp
  return _tmp
end

#_DlistElementObject

DlistElement = Indent* “:” Space+ SinglelineContent:text Newline DlistElementContent+:content position, text, content)



3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
# File 'lib/review/compiler.rb', line 3738

def _DlistElement

  _save = self.pos
  while true # sequence
    while true
      _tmp = apply(:_Indent)
      break unless _tmp
    end
    _tmp = true
    unless _tmp
      self.pos = _save
      break
    end
    _tmp = match_string(":")
    unless _tmp
      self.pos = _save
      break
    end
    _save2 = self.pos
    _tmp = apply(:_Space)
    if _tmp
      while true
        _tmp = apply(:_Space)
        break unless _tmp
      end
      _tmp = true
    else
      self.pos = _save2
    end
    unless _tmp
      self.pos = _save
      break
    end
    _tmp = apply(:_SinglelineContent)
    text = @result
    unless _tmp
      self.pos = _save
      break
    end
    _tmp = apply(:_Newline)
    unless _tmp
      self.pos = _save
      break
    end
    _save3 = self.pos
    _ary = []
    _tmp = apply(:_DlistElementContent)
    if _tmp
      _ary << @result
      while true
        _tmp = apply(:_DlistElementContent)
        _ary << @result if _tmp
        break unless _tmp
      end
      _tmp = true
      @result = _ary
    else
      self.pos = _save3
    end
    content = @result
    unless _tmp
      self.pos = _save
      break
    end
    @result = begin; dlist_element(self, position, text, content); end
    _tmp = true
    unless _tmp
      self.pos = _save
    end
    break
  end # end sequence

  set_failed_rule :_DlistElement unless _tmp
  return _tmp
end

#_DlistElementContentObject

DlistElementContent = (SinglelineComment:c { c } | Space+ SinglelineContent:c Newline { c })



3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
# File 'lib/review/compiler.rb', line 3815

def _DlistElementContent

  _save = self.pos
  while true # choice

    _save1 = self.pos
    while true # sequence
      _tmp = apply(:_SinglelineComment)
      c = @result
      unless _tmp
        self.pos = _save1
        break
      end
      @result = begin;  c ; end
      _tmp = true
      unless _tmp
        self.pos = _save1
      end
      break
    end # end sequence

    break if _tmp
    self.pos = _save

    _save2 = self.pos
    while true # sequence
      _save3 = self.pos
      _tmp = apply(:_Space)
      if _tmp
        while true
          _tmp = apply(:_Space)
          break unless _tmp
        end
        _tmp = true
      else
        self.pos = _save3
      end
      unless _tmp
        self.pos = _save2
        break
      end
      _tmp = apply(:_SinglelineContent)
      c = @result
      unless _tmp
        self.pos = _save2
        break
      end
      _tmp = apply(:_Newline)
      unless _tmp
        self.pos = _save2
        break
      end
      @result = begin;  c ; end
      _tmp = true
      unless _tmp
        self.pos = _save2
      end
      break
    end # end sequence

    break if _tmp
    self.pos = _save
    break
  end # end choice

  set_failed_rule :_DlistElementContent unless _tmp
  return _tmp
end

#_DocumentObject

Document = BOM? Block*:c position, c)



1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
# File 'lib/review/compiler.rb', line 1259

def _Document

  _save = self.pos
  while true # sequence
    _save1 = self.pos
    _tmp = apply(:_BOM)
    unless _tmp
      _tmp = true
      self.pos = _save1
    end
    unless _tmp
      self.pos = _save
      break
    end
    _ary = []
    while true
      _tmp = apply(:_Block)
      _ary << @result if _tmp
      break unless _tmp
    end
    _tmp = true
    @result = _ary
    c = @result
    unless _tmp
      self.pos = _save
      break
    end
    @result = begin; document(self, position, c); end
    _tmp = true
    unless _tmp
      self.pos = _save
    end
    break
  end # end sequence

  set_failed_rule :_Document unless _tmp
  return _tmp
end

#_ElementNameObject

ElementName = < LowerAlphabetAscii+ > { text }



5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
# File 'lib/review/compiler.rb', line 5018

def _ElementName

  _save = self.pos
  while true # sequence
    _text_start = self.pos
    _save1 = self.pos
    _tmp = apply(:_LowerAlphabetAscii)
    if _tmp
      while true
        _tmp = apply(:_LowerAlphabetAscii)
        break unless _tmp
      end
      _tmp = true
    else
      self.pos = _save1
    end
    if _tmp
      text = get_text(_text_start)
    end
    unless _tmp
      self.pos = _save
      break
    end
    @result = begin;  text ; end
    _tmp = true
    unless _tmp
      self.pos = _save
    end
    break
  end # end sequence

  set_failed_rule :_ElementName unless _tmp
  return _tmp
end

#_EnumeratorObject

Enumerator = < /[0-9]+/ > { num = text } “.” { num.to_i }



2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
# File 'lib/review/compiler.rb', line 2762

def _Enumerator

  _save = self.pos
  while true # sequence
    _text_start = self.pos
    _tmp = scan(/\A(?-mix:[0-9]+)/)
    if _tmp
      text = get_text(_text_start)
    end
    unless _tmp
      self.pos = _save
      break
    end
    @result = begin;  num = text ; end
    _tmp = true
    unless _tmp
      self.pos = _save
      break
    end
    _tmp = match_string(".")
    unless _tmp
      self.pos = _save
      break
    end
    @result = begin;  num.to_i ; end
    _tmp = true
    unless _tmp
      self.pos = _save
    end
    break
  end # end sequence

  set_failed_rule :_Enumerator unless _tmp
  return _tmp
end

#_EOFObject

EOF = !.



5008
5009
5010
5011
5012
5013
5014
5015
# File 'lib/review/compiler.rb', line 5008

def _EOF
  _save = self.pos
  _tmp = get_byte
  _tmp = _tmp ? nil : true
  self.pos = _save
  set_failed_rule :_EOF unless _tmp
  return _tmp
end

#_EOLObject

EOL = (Newline | EOF)



4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
# File 'lib/review/compiler.rb', line 4990

def _EOL

  _save = self.pos
  while true # choice
    _tmp = apply(:_Newline)
    break if _tmp
    self.pos = _save
    _tmp = apply(:_EOF)
    break if _tmp
    self.pos = _save
    break
  end # end choice

  set_failed_rule :_EOL unless _tmp
  return _tmp
end

#_HeadlineObject

Headline = HeadlinePrefix:level BracketArg?:cmd BraceArg?:label Space* SinglelineContent?:caption EOL position, level, cmd, label, caption)



1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
# File 'lib/review/compiler.rb', line 1426

def _Headline

  _save = self.pos
  while true # sequence
    _tmp = apply(:_HeadlinePrefix)
    level = @result
    unless _tmp
      self.pos = _save
      break
    end
    _save1 = self.pos
    _tmp = apply(:_BracketArg)
    @result = nil unless _tmp
    unless _tmp
      _tmp = true
      self.pos = _save1
    end
    cmd = @result
    unless _tmp
      self.pos = _save
      break
    end
    _save2 = self.pos
    _tmp = apply(:_BraceArg)
    @result = nil unless _tmp
    unless _tmp
      _tmp = true
      self.pos = _save2
    end
    label = @result
    unless _tmp
      self.pos = _save
      break
    end
    while true
      _tmp = apply(:_Space)
      break unless _tmp
    end
    _tmp = true
    unless _tmp
      self.pos = _save
      break
    end
    _save4 = self.pos
    _tmp = apply(:_SinglelineContent)
    @result = nil unless _tmp
    unless _tmp
      _tmp = true
      self.pos = _save4
    end
    caption = @result
    unless _tmp
      self.pos = _save
      break
    end
    _tmp = apply(:_EOL)
    unless _tmp
      self.pos = _save
      break
    end
    @result = begin; headline(self, position, level, cmd, label, caption); end
    _tmp = true
    unless _tmp
      self.pos = _save
    end
    break
  end # end sequence

  set_failed_rule :_Headline unless _tmp
  return _tmp
end

#_HeadlinePrefixObject

HeadlinePrefix = < /=1,5/ > { text.length }



1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
# File 'lib/review/compiler.rb', line 1499

def _HeadlinePrefix

  _save = self.pos
  while true # sequence
    _text_start = self.pos
    _tmp = scan(/\A(?-mix:={1,5})/)
    if _tmp
      text = get_text(_text_start)
    end
    unless _tmp
      self.pos = _save
      break
    end
    @result = begin;  text.length ; end
    _tmp = true
    unless _tmp
      self.pos = _save
    end
    break
  end # end sequence

  set_failed_rule :_HeadlinePrefix unless _tmp
  return _tmp
end

#_IndentObject

Indent = “ ”



4983
4984
4985
4986
4987
# File 'lib/review/compiler.rb', line 4983

def _Indent
  _tmp = match_string(" ")
  set_failed_rule :_Indent unless _tmp
  return _tmp
end

#_InlineObject

Inline = (InlineElement | NonInlineElement)



3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
# File 'lib/review/compiler.rb', line 3922

def _Inline

  _save = self.pos
  while true # choice
    _tmp = apply(:_InlineElement)
    break if _tmp
    self.pos = _save
    _tmp = apply(:_NonInlineElement)
    break if _tmp
    self.pos = _save
    break
  end # end choice

  set_failed_rule :_Inline unless _tmp
  return _tmp
end

#_InlineElementObject

InlineElement = (RawInlineElement:c { c } | !RawInlineElement “@<” InlineElementSymbol:symbol “>” “InlineElementContents?:contents “” position, symbol,contents) | !RawInlineElement “@<” ComplexInlineElementSymbol:symbol “>” “ComplexInlineElementContents?:contents “” position, symbol,contents))



3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
# File 'lib/review/compiler.rb', line 3974

def _InlineElement

  _save = self.pos
  while true # choice

    _save1 = self.pos
    while true # sequence
      _tmp = apply(:_RawInlineElement)
      c = @result
      unless _tmp
        self.pos = _save1
        break
      end
      @result = begin;  c ; end
      _tmp = true
      unless _tmp
        self.pos = _save1
      end
      break
    end # end sequence

    break if _tmp
    self.pos = _save

    _save2 = self.pos
    while true # sequence
      _save3 = self.pos
      _tmp = apply(:_RawInlineElement)
      _tmp = _tmp ? nil : true
      self.pos = _save3
      unless _tmp
        self.pos = _save2
        break
      end
      _tmp = match_string("@<")
      unless _tmp
        self.pos = _save2
        break
      end
      _tmp = apply(:_InlineElementSymbol)
      symbol = @result
      unless _tmp
        self.pos = _save2
        break
      end
      _tmp = match_string(">")
      unless _tmp
        self.pos = _save2
        break
      end
      _tmp = match_string("{")
      unless _tmp
        self.pos = _save2
        break
      end
      _save4 = self.pos
      _tmp = apply(:_InlineElementContents)
      @result = nil unless _tmp
      unless _tmp
        _tmp = true
        self.pos = _save4
      end
      contents = @result
      unless _tmp
        self.pos = _save2
        break
      end
      _tmp = match_string("}")
      unless _tmp
        self.pos = _save2
        break
      end
      @result = begin; inline_element(self, position, symbol,contents); end
      _tmp = true
      unless _tmp
        self.pos = _save2
      end
      break
    end # end sequence

    break if _tmp
    self.pos = _save

    _save5 = self.pos
    while true # sequence
      _save6 = self.pos
      _tmp = apply(:_RawInlineElement)
      _tmp = _tmp ? nil : true
      self.pos = _save6
      unless _tmp
        self.pos = _save5
        break
      end
      _tmp = match_string("@<")
      unless _tmp
        self.pos = _save5
        break
      end
      _tmp = apply(:_ComplexInlineElementSymbol)
      symbol = @result
      unless _tmp
        self.pos = _save5
        break
      end
      _tmp = match_string(">")
      unless _tmp
        self.pos = _save5
        break
      end
      _tmp = match_string("{")
      unless _tmp
        self.pos = _save5
        break
      end
      _save7 = self.pos
      _tmp = apply(:_ComplexInlineElementContents)
      @result = nil unless _tmp
      unless _tmp
        _tmp = true
        self.pos = _save7
      end
      contents = @result
      unless _tmp
        self.pos = _save5
        break
      end
      _tmp = match_string("}")
      unless _tmp
        self.pos = _save5
        break
      end
      @result = begin; complex_inline_element(self, position, symbol,contents); end
      _tmp = true
      unless _tmp
        self.pos = _save5
      end
      break
    end # end sequence

    break if _tmp
    self.pos = _save
    break
  end # end choice

  set_failed_rule :_InlineElement unless _tmp
  return _tmp
end

#_InlineElementContentObject

InlineElementContent = InlineElementContentSub+:d { d }



4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
# File 'lib/review/compiler.rb', line 4546

def _InlineElementContent

  _save = self.pos
  while true # sequence
    _save1 = self.pos
    _ary = []
    _tmp = apply(:_InlineElementContentSub)
    if _tmp
      _ary << @result
      while true
        _tmp = apply(:_InlineElementContentSub)
        _ary << @result if _tmp
        break unless _tmp
      end
      _tmp = true
      @result = _ary
    else
      self.pos = _save1
    end
    d = @result
    unless _tmp
      self.pos = _save
      break
    end
    @result = begin;  d ; end
    _tmp = true
    unless _tmp
      self.pos = _save
    end
    break
  end # end sequence

  set_failed_rule :_InlineElementContent unless _tmp
  return _tmp
end

#_InlineElementContentsObject

InlineElementContents = !“}” InlineElementContentsSub:c { c }



4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
# File 'lib/review/compiler.rb', line 4278

def _InlineElementContents

  _save = self.pos
  while true # sequence
    _save1 = self.pos
    _tmp = match_string("}")
    _tmp = _tmp ? nil : true
    self.pos = _save1
    unless _tmp
      self.pos = _save
      break
    end
    _tmp = apply(:_InlineElementContentsSub)
    c = @result
    unless _tmp
      self.pos = _save
      break
    end
    @result = begin;  c ; end
    _tmp = true
    unless _tmp
      self.pos = _save
    end
    break
  end # end sequence

  set_failed_rule :_InlineElementContents unless _tmp
  return _tmp
end

#_InlineElementContentsSubObject

InlineElementContentsSub = !“}” Space* InlineElementContent:c1 Space* { [c1] }



4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
# File 'lib/review/compiler.rb', line 4309

def _InlineElementContentsSub

  _save = self.pos
  while true # sequence
    _save1 = self.pos
    _tmp = match_string("}")
    _tmp = _tmp ? nil : true
    self.pos = _save1
    unless _tmp
      self.pos = _save
      break
    end
    while true
      _tmp = apply(:_Space)
      break unless _tmp
    end
    _tmp = true
    unless _tmp
      self.pos = _save
      break
    end
    _tmp = apply(:_InlineElementContent)
    c1 = @result
    unless _tmp
      self.pos = _save
      break
    end
    while true
      _tmp = apply(:_Space)
      break unless _tmp
    end
    _tmp = true
    unless _tmp
      self.pos = _save
      break
    end
    @result = begin;  [c1] ; end
    _tmp = true
    unless _tmp
      self.pos = _save
    end
    break
  end # end sequence

  set_failed_rule :_InlineElementContentsSub unless _tmp
  return _tmp
end

#_InlineElementContentSubObject

InlineElementContentSub = (InlineElement:c { c } | !InlineElement QuotedInlineText:content position, content) | !InlineElement InlineElementContentText+:content position, content))



4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
# File 'lib/review/compiler.rb', line 4583

def _InlineElementContentSub

  _save = self.pos
  while true # choice

    _save1 = self.pos
    while true # sequence
      _tmp = apply(:_InlineElement)
      c = @result
      unless _tmp
        self.pos = _save1
        break
      end
      @result = begin;  c ; end
      _tmp = true
      unless _tmp
        self.pos = _save1
      end
      break
    end # end sequence

    break if _tmp
    self.pos = _save

    _save2 = self.pos
    while true # sequence
      _save3 = self.pos
      _tmp = apply(:_InlineElement)
      _tmp = _tmp ? nil : true
      self.pos = _save3
      unless _tmp
        self.pos = _save2
        break
      end
      _tmp = apply(:_QuotedInlineText)
      content = @result
      unless _tmp
        self.pos = _save2
        break
      end
      @result = begin; inline_element_content(self, position, content); end
      _tmp = true
      unless _tmp
        self.pos = _save2
      end
      break
    end # end sequence

    break if _tmp
    self.pos = _save

    _save4 = self.pos
    while true # sequence
      _save5 = self.pos
      _tmp = apply(:_InlineElement)
      _tmp = _tmp ? nil : true
      self.pos = _save5
      unless _tmp
        self.pos = _save4
        break
      end
      _save6 = self.pos
      _ary = []
      _tmp = apply(:_InlineElementContentText)
      if _tmp
        _ary << @result
        while true
          _tmp = apply(:_InlineElementContentText)
          _ary << @result if _tmp
          break unless _tmp
        end
        _tmp = true
        @result = _ary
      else
        self.pos = _save6
      end
      content = @result
      unless _tmp
        self.pos = _save4
        break
      end
      @result = begin; inline_element_content(self, position, content); end
      _tmp = true
      unless _tmp
        self.pos = _save4
      end
      break
    end # end sequence

    break if _tmp
    self.pos = _save
    break
  end # end choice

  set_failed_rule :_InlineElementContentSub unless _tmp
  return _tmp
end

#_InlineElementContentTextObject

InlineElementContentText = (“\}” position, “”)} | “\,” position, “,”) | “\\” position, “\” ) | “\” position, “\” ) | !InlineElement < /[^rn\},]/ > position, text))



4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
# File 'lib/review/compiler.rb', line 4855

def _InlineElementContentText

  _save = self.pos
  while true # choice

    _save1 = self.pos
    while true # sequence
      _tmp = match_string("\\}")
      unless _tmp
        self.pos = _save1
        break
      end
      @result = begin; text(self, position, "}"); end
      _tmp = true
      unless _tmp
        self.pos = _save1
      end
      break
    end # end sequence

    break if _tmp
    self.pos = _save

    _save2 = self.pos
    while true # sequence
      _tmp = match_string("\\,")
      unless _tmp
        self.pos = _save2
        break
      end
      @result = begin; text(self, position, ","); end
      _tmp = true
      unless _tmp
        self.pos = _save2
      end
      break
    end # end sequence

    break if _tmp
    self.pos = _save

    _save3 = self.pos
    while true # sequence
      _tmp = match_string("\\\\")
      unless _tmp
        self.pos = _save3
        break
      end
      @result = begin; text(self, position, "\\" ); end
      _tmp = true
      unless _tmp
        self.pos = _save3
      end
      break
    end # end sequence

    break if _tmp
    self.pos = _save

    _save4 = self.pos
    while true # sequence
      _tmp = match_string("\\")
      unless _tmp
        self.pos = _save4
        break
      end
      @result = begin; text(self, position, "\\" ); end
      _tmp = true
      unless _tmp
        self.pos = _save4
      end
      break
    end # end sequence

    break if _tmp
    self.pos = _save

    _save5 = self.pos
    while true # sequence
      _save6 = self.pos
      _tmp = apply(:_InlineElement)
      _tmp = _tmp ? nil : true
      self.pos = _save6
      unless _tmp
        self.pos = _save5
        break
      end
      _text_start = self.pos
      _tmp = scan(/\A(?-mix:[^\r\n\\},])/)
      if _tmp
        text = get_text(_text_start)
      end
      unless _tmp
        self.pos = _save5
        break
      end
      @result = begin; text(self, position, text); end
      _tmp = true
      unless _tmp
        self.pos = _save5
      end
      break
    end # end sequence

    break if _tmp
    self.pos = _save
    break
  end # end choice

  set_failed_rule :_InlineElementContentText unless _tmp
  return _tmp
end

#_InlineElementSymbolObject

InlineElementSymbol = < AlphanumericAscii+ >:s &{ check_inline_element_symbol(text) } { text }



4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
# File 'lib/review/compiler.rb', line 4234

def _InlineElementSymbol

  _save = self.pos
  while true # sequence
    _text_start = self.pos
    _save1 = self.pos
    _tmp = apply(:_AlphanumericAscii)
    if _tmp
      while true
        _tmp = apply(:_AlphanumericAscii)
        break unless _tmp
      end
      _tmp = true
    else
      self.pos = _save1
    end
    if _tmp
      text = get_text(_text_start)
    end
    s = @result
    unless _tmp
      self.pos = _save
      break
    end
    _save2 = self.pos
    _tmp = begin;  check_inline_element_symbol(text) ; end
    self.pos = _save2
    unless _tmp
      self.pos = _save
      break
    end
    @result = begin;  text ; end
    _tmp = true
    unless _tmp
      self.pos = _save
    end
    break
  end # end sequence

  set_failed_rule :_InlineElementSymbol unless _tmp
  return _tmp
end

#_ListItemFirstLineObject

ListItemFirstLine = SinglelineContent:c Newline { c }



3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
# File 'lib/review/compiler.rb', line 3102

def _ListItemFirstLine

  _save = self.pos
  while true # sequence
    _tmp = apply(:_SinglelineContent)
    c = @result
    unless _tmp
      self.pos = _save
      break
    end
    _tmp = apply(:_Newline)
    unless _tmp
      self.pos = _save
      break
    end
    @result = begin;  c ; end
    _tmp = true
    unless _tmp
      self.pos = _save
    end
    break
  end # end sequence

  set_failed_rule :_ListItemFirstLine unless _tmp
  return _tmp
end

#_ListItemLineObject

ListItemLine = Indent+:s !Bullet !Enumerator !Space SinglelineContent:c &{ check_indent(s) } Newline { c }



3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
# File 'lib/review/compiler.rb', line 3130

def _ListItemLine

  _save = self.pos
  while true # sequence
    _save1 = self.pos
    _ary = []
    _tmp = apply(:_Indent)
    if _tmp
      _ary << @result
      while true
        _tmp = apply(:_Indent)
        _ary << @result if _tmp
        break unless _tmp
      end
      _tmp = true
      @result = _ary
    else
      self.pos = _save1
    end
    s = @result
    unless _tmp
      self.pos = _save
      break
    end
    _save2 = self.pos
    _tmp = apply(:_Bullet)
    _tmp = _tmp ? nil : true
    self.pos = _save2
    unless _tmp
      self.pos = _save
      break
    end
    _save3 = self.pos
    _tmp = apply(:_Enumerator)
    _tmp = _tmp ? nil : true
    self.pos = _save3
    unless _tmp
      self.pos = _save
      break
    end
    _save4 = self.pos
    _tmp = apply(:_Space)
    _tmp = _tmp ? nil : true
    self.pos = _save4
    unless _tmp
      self.pos = _save
      break
    end
    _tmp = apply(:_SinglelineContent)
    c = @result
    unless _tmp
      self.pos = _save
      break
    end
    _save5 = self.pos
    _tmp = begin;  check_indent(s) ; end
    self.pos = _save5
    unless _tmp
      self.pos = _save
      break
    end
    _tmp = apply(:_Newline)
    unless _tmp
      self.pos = _save
      break
    end
    @result = begin;  c ; end
    _tmp = true
    unless _tmp
      self.pos = _save
    end
    break
  end # end sequence

  set_failed_rule :_ListItemLine unless _tmp
  return _tmp
end

#_LowerAlphabetAsciiObject

LowerAlphabetAscii = /[a-z]/



5061
5062
5063
5064
5065
# File 'lib/review/compiler.rb', line 5061

def _LowerAlphabetAscii
  _tmp = scan(/\A(?-mix:[a-z])/)
  set_failed_rule :_LowerAlphabetAscii unless _tmp
  return _tmp
end

#_NestedListObject

NestedList = (NestedUlist | NestedOlist)



3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
# File 'lib/review/compiler.rb', line 3440

def _NestedList

  _save = self.pos
  while true # choice
    _tmp = apply(:_NestedUlist)
    break if _tmp
    self.pos = _save
    _tmp = apply(:_NestedOlist)
    break if _tmp
    self.pos = _save
    break
  end # end choice

  set_failed_rule :_NestedList unless _tmp
  return _tmp
end

#_NestedOlistObject

NestedOlist = Indent+:s Enumerator:e Space+ &{ check_nested_indent(s) } { @list_stack.push(s) } OlistItemBlock:item { item.num = e } (OlistItem | NestedList)*:items &{ s == @list_stack.pop } position, items.unshift(item))



3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
# File 'lib/review/compiler.rb', line 3565

def _NestedOlist

  _save = self.pos
  while true # sequence
    _save1 = self.pos
    _ary = []
    _tmp = apply(:_Indent)
    if _tmp
      _ary << @result
      while true
        _tmp = apply(:_Indent)
        _ary << @result if _tmp
        break unless _tmp
      end
      _tmp = true
      @result = _ary
    else
      self.pos = _save1
    end
    s = @result
    unless _tmp
      self.pos = _save
      break
    end
    _tmp = apply(:_Enumerator)
    e = @result
    unless _tmp
      self.pos = _save
      break
    end
    _save2 = self.pos
    _tmp = apply(:_Space)
    if _tmp
      while true
        _tmp = apply(:_Space)
        break unless _tmp
      end
      _tmp = true
    else
      self.pos = _save2
    end
    unless _tmp
      self.pos = _save
      break
    end
    _save3 = self.pos
    _tmp = begin;  check_nested_indent(s) ; end
    self.pos = _save3
    unless _tmp
      self.pos = _save
      break
    end
    @result = begin;  @list_stack.push(s) ; end
    _tmp = true
    unless _tmp
      self.pos = _save
      break
    end
    _tmp = apply(:_OlistItemBlock)
    item = @result
    unless _tmp
      self.pos = _save
      break
    end
    @result = begin;  item.num = e ; end
    _tmp = true
    unless _tmp
      self.pos = _save
      break
    end
    _ary = []
    while true

      _save5 = self.pos
      while true # choice
        _tmp = apply(:_OlistItem)
        break if _tmp
        self.pos = _save5
        _tmp = apply(:_NestedList)
        break if _tmp
        self.pos = _save5
        break
      end # end choice

      _ary << @result if _tmp
      break unless _tmp
    end
    _tmp = true
    @result = _ary
    items = @result
    unless _tmp
      self.pos = _save
      break
    end
    _save6 = self.pos
    _tmp = begin;  s == @list_stack.pop ; end
    self.pos = _save6
    unless _tmp
      self.pos = _save
      break
    end
    @result = begin; olist(self, position, items.unshift(item)); end
    _tmp = true
    unless _tmp
      self.pos = _save
    end
    break
  end # end sequence

  set_failed_rule :_NestedOlist unless _tmp
  return _tmp
end

#_NestedUlistObject

NestedUlist = Indent+:s Bullet Space+ &{ check_nested_indent(s) } { @list_stack.push(s) } UlistItemBlock:item (UlistItem | NestedList)*:items &{ s == @list_stack.pop } position, items.unshift(item))



3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
# File 'lib/review/compiler.rb', line 3458

def _NestedUlist

  _save = self.pos
  while true # sequence
    _save1 = self.pos
    _ary = []
    _tmp = apply(:_Indent)
    if _tmp
      _ary << @result
      while true
        _tmp = apply(:_Indent)
        _ary << @result if _tmp
        break unless _tmp
      end
      _tmp = true
      @result = _ary
    else
      self.pos = _save1
    end
    s = @result
    unless _tmp
      self.pos = _save
      break
    end
    _tmp = apply(:_Bullet)
    unless _tmp
      self.pos = _save
      break
    end
    _save2 = self.pos
    _tmp = apply(:_Space)
    if _tmp
      while true
        _tmp = apply(:_Space)
        break unless _tmp
      end
      _tmp = true
    else
      self.pos = _save2
    end
    unless _tmp
      self.pos = _save
      break
    end
    _save3 = self.pos
    _tmp = begin;  check_nested_indent(s) ; end
    self.pos = _save3
    unless _tmp
      self.pos = _save
      break
    end
    @result = begin;  @list_stack.push(s) ; end
    _tmp = true
    unless _tmp
      self.pos = _save
      break
    end
    _tmp = apply(:_UlistItemBlock)
    item = @result
    unless _tmp
      self.pos = _save
      break
    end
    _ary = []
    while true

      _save5 = self.pos
      while true # choice
        _tmp = apply(:_UlistItem)
        break if _tmp
        self.pos = _save5
        _tmp = apply(:_NestedList)
        break if _tmp
        self.pos = _save5
        break
      end # end choice

      _ary << @result if _tmp
      break unless _tmp
    end
    _tmp = true
    @result = _ary
    items = @result
    unless _tmp
      self.pos = _save
      break
    end
    _save6 = self.pos
    _tmp = begin;  s == @list_stack.pop ; end
    self.pos = _save6
    unless _tmp
      self.pos = _save
      break
    end
    @result = begin; ulist(self, position, items.unshift(item)); end
    _tmp = true
    unless _tmp
      self.pos = _save
    end
    break
  end # end sequence

  set_failed_rule :_NestedUlist unless _tmp
  return _tmp
end

#_NewlineObject

Newline = /n|rn?|pZl|pZp/ position, “n”)



5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
# File 'lib/review/compiler.rb', line 5082

def _Newline

  _save = self.pos
  while true # sequence
    _tmp = scan(/\A(?-mix:\n|\r\n?|\p{Zl}|\p{Zp})/)
    unless _tmp
      self.pos = _save
      break
    end
    @result = begin; newline(self, position, "\n"); end
    _tmp = true
    unless _tmp
      self.pos = _save
    end
    break
  end # end sequence

  set_failed_rule :_Newline unless _tmp
  return _tmp
end

#_NonInlineElementObject

NonInlineElement = !InlineElement < NonNewline > position, text)



3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
# File 'lib/review/compiler.rb', line 3940

def _NonInlineElement

  _save = self.pos
  while true # sequence
    _save1 = self.pos
    _tmp = apply(:_InlineElement)
    _tmp = _tmp ? nil : true
    self.pos = _save1
    unless _tmp
      self.pos = _save
      break
    end
    _text_start = self.pos
    _tmp = apply(:_NonNewline)
    if _tmp
      text = get_text(_text_start)
    end
    unless _tmp
      self.pos = _save
      break
    end
    @result = begin; text(self, position, text); end
    _tmp = true
    unless _tmp
      self.pos = _save
    end
    break
  end # end sequence

  set_failed_rule :_NonInlineElement unless _tmp
  return _tmp
end

#_NonNewlineObject

NonNewline = /[^rn]/



4969
4970
4971
4972
4973
# File 'lib/review/compiler.rb', line 4969

def _NonNewline
  _tmp = scan(/\A(?-mix:[^\r\n])/)
  set_failed_rule :_NonNewline unless _tmp
  return _tmp
end

#_OlistObject

Olist = Indent+:s Enumerator:e Space+ { @list_stack.push(s) } OlistItemBlock:item { item.num = e } (OlistItem | NestedList)*:items &{ s == @list_stack.pop } position, items.unshift(item))



2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
# File 'lib/review/compiler.rb', line 2923

def _Olist

  _save = self.pos
  while true # sequence
    _save1 = self.pos
    _ary = []
    _tmp = apply(:_Indent)
    if _tmp
      _ary << @result
      while true
        _tmp = apply(:_Indent)
        _ary << @result if _tmp
        break unless _tmp
      end
      _tmp = true
      @result = _ary
    else
      self.pos = _save1
    end
    s = @result
    unless _tmp
      self.pos = _save
      break
    end
    _tmp = apply(:_Enumerator)
    e = @result
    unless _tmp
      self.pos = _save
      break
    end
    _save2 = self.pos
    _tmp = apply(:_Space)
    if _tmp
      while true
        _tmp = apply(:_Space)
        break unless _tmp
      end
      _tmp = true
    else
      self.pos = _save2
    end
    unless _tmp
      self.pos = _save
      break
    end
    @result = begin;  @list_stack.push(s) ; end
    _tmp = true
    unless _tmp
      self.pos = _save
      break
    end
    _tmp = apply(:_OlistItemBlock)
    item = @result
    unless _tmp
      self.pos = _save
      break
    end
    @result = begin;  item.num = e ; end
    _tmp = true
    unless _tmp
      self.pos = _save
      break
    end
    _ary = []
    while true

      _save4 = self.pos
      while true # choice
        _tmp = apply(:_OlistItem)
        break if _tmp
        self.pos = _save4
        _tmp = apply(:_NestedList)
        break if _tmp
        self.pos = _save4
        break
      end # end choice

      _ary << @result if _tmp
      break unless _tmp
    end
    _tmp = true
    @result = _ary
    items = @result
    unless _tmp
      self.pos = _save
      break
    end
    _save5 = self.pos
    _tmp = begin;  s == @list_stack.pop ; end
    self.pos = _save5
    unless _tmp
      self.pos = _save
      break
    end
    @result = begin; olist(self, position, items.unshift(item)); end
    _tmp = true
    unless _tmp
      self.pos = _save
    end
    break
  end # end sequence

  set_failed_rule :_Olist unless _tmp
  return _tmp
end

#_OlistItemObject

OlistItem = Indent+:s Enumerator:e Space+ &{ check_indent(s) } OlistItemBlock:item { item.num = e; item }



3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
# File 'lib/review/compiler.rb', line 3369

def _OlistItem

  _save = self.pos
  while true # sequence
    _save1 = self.pos
    _ary = []
    _tmp = apply(:_Indent)
    if _tmp
      _ary << @result
      while true
        _tmp = apply(:_Indent)
        _ary << @result if _tmp
        break unless _tmp
      end
      _tmp = true
      @result = _ary
    else
      self.pos = _save1
    end
    s = @result
    unless _tmp
      self.pos = _save
      break
    end
    _tmp = apply(:_Enumerator)
    e = @result
    unless _tmp
      self.pos = _save
      break
    end
    _save2 = self.pos
    _tmp = apply(:_Space)
    if _tmp
      while true
        _tmp = apply(:_Space)
        break unless _tmp
      end
      _tmp = true
    else
      self.pos = _save2
    end
    unless _tmp
      self.pos = _save
      break
    end
    _save3 = self.pos
    _tmp = begin;  check_indent(s) ; end
    self.pos = _save3
    unless _tmp
      self.pos = _save
      break
    end
    _tmp = apply(:_OlistItemBlock)
    item = @result
    unless _tmp
      self.pos = _save
      break
    end
    @result = begin;  item.num = e; item ; end
    _tmp = true
    unless _tmp
      self.pos = _save
    end
    break
  end # end sequence

  set_failed_rule :_OlistItem unless _tmp
  return _tmp
end

#_OlistItemBlockObject

OlistItemBlock = ListItemFirstLine:c ListItemLine*:d position, 0, d.unshift©)



3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
# File 'lib/review/compiler.rb', line 3066

def _OlistItemBlock

  _save = self.pos
  while true # sequence
    _tmp = apply(:_ListItemFirstLine)
    c = @result
    unless _tmp
      self.pos = _save
      break
    end
    _ary = []
    while true
      _tmp = apply(:_ListItemLine)
      _ary << @result if _tmp
      break unless _tmp
    end
    _tmp = true
    @result = _ary
    d = @result
    unless _tmp
      self.pos = _save
      break
    end
    @result = begin; olist_element(self, position, 0, d.unshift(c)); end
    _tmp = true
    unless _tmp
      self.pos = _save
    end
    break
  end # end sequence

  set_failed_rule :_OlistItemBlock unless _tmp
  return _tmp
end

#_ParagraphObject

Paragraph = ParagraphLine+:c position, c.flatten)



1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
# File 'lib/review/compiler.rb', line 1525

def _Paragraph

  _save = self.pos
  while true # sequence
    _save1 = self.pos
    _ary = []
    _tmp = apply(:_ParagraphLine)
    if _tmp
      _ary << @result
      while true
        _tmp = apply(:_ParagraphLine)
        _ary << @result if _tmp
        break unless _tmp
      end
      _tmp = true
      @result = _ary
    else
      self.pos = _save1
    end
    c = @result
    unless _tmp
      self.pos = _save
      break
    end
    @result = begin; paragraph(self, position, c.flatten); end
    _tmp = true
    unless _tmp
      self.pos = _save
    end
    break
  end # end sequence

  set_failed_rule :_Paragraph unless _tmp
  return _tmp
end

#_ParagraphLineObject

ParagraphLine = !Headline !SinglelineComment !BlockElement !Ulist !Olist !Dlist SinglelineContent:c Newline { c }



1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
# File 'lib/review/compiler.rb', line 1562

def _ParagraphLine

  _save = self.pos
  while true # sequence
    _save1 = self.pos
    _tmp = apply(:_Headline)
    _tmp = _tmp ? nil : true
    self.pos = _save1
    unless _tmp
      self.pos = _save
      break
    end
    _save2 = self.pos
    _tmp = apply(:_SinglelineComment)
    _tmp = _tmp ? nil : true
    self.pos = _save2
    unless _tmp
      self.pos = _save
      break
    end
    _save3 = self.pos
    _tmp = apply(:_BlockElement)
    _tmp = _tmp ? nil : true
    self.pos = _save3
    unless _tmp
      self.pos = _save
      break
    end
    _save4 = self.pos
    _tmp = apply(:_Ulist)
    _tmp = _tmp ? nil : true
    self.pos = _save4
    unless _tmp
      self.pos = _save
      break
    end
    _save5 = self.pos
    _tmp = apply(:_Olist)
    _tmp = _tmp ? nil : true
    self.pos = _save5
    unless _tmp
      self.pos = _save
      break
    end
    _save6 = self.pos
    _tmp = apply(:_Dlist)
    _tmp = _tmp ? nil : true
    self.pos = _save6
    unless _tmp
      self.pos = _save
      break
    end
    _tmp = apply(:_SinglelineContent)
    c = @result
    unless _tmp
      self.pos = _save
      break
    end
    _tmp = apply(:_Newline)
    unless _tmp
      self.pos = _save
      break
    end
    @result = begin;  c ; end
    _tmp = true
    unless _tmp
      self.pos = _save
    end
    break
  end # end sequence

  set_failed_rule :_ParagraphLine unless _tmp
  return _tmp
end

#_QuotedInlineTextObject

QuotedInlineText = “"” (“\"” { “"” } | “\\” { “\” } | < /[^“rn\]/ > { text })+:str ”"“ position, str.join(”“))



4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
# File 'lib/review/compiler.rb', line 4682

def _QuotedInlineText

  _save = self.pos
  while true # sequence
    _tmp = match_string("\"")
    unless _tmp
      self.pos = _save
      break
    end
    _save1 = self.pos
    _ary = []

    _save2 = self.pos
    while true # choice

      _save3 = self.pos
      while true # sequence
        _tmp = match_string("\\\"")
        unless _tmp
          self.pos = _save3
          break
        end
        @result = begin;  "\"" ; end
        _tmp = true
        unless _tmp
          self.pos = _save3
        end
        break
      end # end sequence

      break if _tmp
      self.pos = _save2

      _save4 = self.pos
      while true # sequence
        _tmp = match_string("\\\\")
        unless _tmp
          self.pos = _save4
          break
        end
        @result = begin;  "\\" ; end
        _tmp = true
        unless _tmp
          self.pos = _save4
        end
        break
      end # end sequence

      break if _tmp
      self.pos = _save2

      _save5 = self.pos
      while true # sequence
        _text_start = self.pos
        _tmp = scan(/\A(?-mix:[^"\r\n\\])/)
        if _tmp
          text = get_text(_text_start)
        end
        unless _tmp
          self.pos = _save5
          break
        end
        @result = begin;  text ; end
        _tmp = true
        unless _tmp
          self.pos = _save5
        end
        break
      end # end sequence

      break if _tmp
      self.pos = _save2
      break
    end # end choice

    if _tmp
      _ary << @result
      while true

        _save6 = self.pos
        while true # choice

          _save7 = self.pos
          while true # sequence
            _tmp = match_string("\\\"")
            unless _tmp
              self.pos = _save7
              break
            end
            @result = begin;  "\"" ; end
            _tmp = true
            unless _tmp
              self.pos = _save7
            end
            break
          end # end sequence

          break if _tmp
          self.pos = _save6

          _save8 = self.pos
          while true # sequence
            _tmp = match_string("\\\\")
            unless _tmp
              self.pos = _save8
              break
            end
            @result = begin;  "\\" ; end
            _tmp = true
            unless _tmp
              self.pos = _save8
            end
            break
          end # end sequence

          break if _tmp
          self.pos = _save6

          _save9 = self.pos
          while true # sequence
            _text_start = self.pos
            _tmp = scan(/\A(?-mix:[^"\r\n\\])/)
            if _tmp
              text = get_text(_text_start)
            end
            unless _tmp
              self.pos = _save9
              break
            end
            @result = begin;  text ; end
            _tmp = true
            unless _tmp
              self.pos = _save9
            end
            break
          end # end sequence

          break if _tmp
          self.pos = _save6
          break
        end # end choice

        _ary << @result if _tmp
        break unless _tmp
      end
      _tmp = true
      @result = _ary
    else
      self.pos = _save1
    end
    str = @result
    unless _tmp
      self.pos = _save
      break
    end
    _tmp = match_string("\"")
    unless _tmp
      self.pos = _save
      break
    end
    @result = begin; text(self, position, str.join("")); end
    _tmp = true
    unless _tmp
      self.pos = _save
    end
    break
  end # end sequence

  set_failed_rule :_QuotedInlineText unless _tmp
  return _tmp
end

#_RawBlockBuilderSelectObject

RawBlockBuilderSelect = “|” Space* RawBlockBuilderSelectSub:c Space* “|” { c }



1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
# File 'lib/review/compiler.rb', line 1968

def _RawBlockBuilderSelect

  _save = self.pos
  while true # sequence
    _tmp = match_string("|")
    unless _tmp
      self.pos = _save
      break
    end
    while true
      _tmp = apply(:_Space)
      break unless _tmp
    end
    _tmp = true
    unless _tmp
      self.pos = _save
      break
    end
    _tmp = apply(:_RawBlockBuilderSelectSub)
    c = @result
    unless _tmp
      self.pos = _save
      break
    end
    while true
      _tmp = apply(:_Space)
      break unless _tmp
    end
    _tmp = true
    unless _tmp
      self.pos = _save
      break
    end
    _tmp = match_string("|")
    unless _tmp
      self.pos = _save
      break
    end
    @result = begin;  c ; end
    _tmp = true
    unless _tmp
      self.pos = _save
    end
    break
  end # end sequence

  set_failed_rule :_RawBlockBuilderSelect unless _tmp
  return _tmp
end

#_RawBlockBuilderSelectSubObject

RawBlockBuilderSelectSub = (< AlphanumericAscii+ >:c1 Space* “,” Space* RawBlockBuilderSelectSub:c2 { [text] + c2 } | < AlphanumericAscii+ >:c1 { [text] })



2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
# File 'lib/review/compiler.rb', line 2019

def _RawBlockBuilderSelectSub

  _save = self.pos
  while true # choice

    _save1 = self.pos
    while true # sequence
      _text_start = self.pos
      _save2 = self.pos
      _tmp = apply(:_AlphanumericAscii)
      if _tmp
        while true
          _tmp = apply(:_AlphanumericAscii)
          break unless _tmp
        end
        _tmp = true
      else
        self.pos = _save2
      end
      if _tmp
        text = get_text(_text_start)
      end
      c1 = @result
      unless _tmp
        self.pos = _save1
        break
      end
      while true
        _tmp = apply(:_Space)
        break unless _tmp
      end
      _tmp = true
      unless _tmp
        self.pos = _save1
        break
      end
      _tmp = match_string(",")
      unless _tmp
        self.pos = _save1
        break
      end
      while true
        _tmp = apply(:_Space)
        break unless _tmp
      end
      _tmp = true
      unless _tmp
        self.pos = _save1
        break
      end
      _tmp = apply(:_RawBlockBuilderSelectSub)
      c2 = @result
      unless _tmp
        self.pos = _save1
        break
      end
      @result = begin;  [text] + c2 ; end
      _tmp = true
      unless _tmp
        self.pos = _save1
      end
      break
    end # end sequence

    break if _tmp
    self.pos = _save

    _save5 = self.pos
    while true # sequence
      _text_start = self.pos
      _save6 = self.pos
      _tmp = apply(:_AlphanumericAscii)
      if _tmp
        while true
          _tmp = apply(:_AlphanumericAscii)
          break unless _tmp
        end
        _tmp = true
      else
        self.pos = _save6
      end
      if _tmp
        text = get_text(_text_start)
      end
      c1 = @result
      unless _tmp
        self.pos = _save5
        break
      end
      @result = begin;  [text] ; end
      _tmp = true
      unless _tmp
        self.pos = _save5
      end
      break
    end # end sequence

    break if _tmp
    self.pos = _save
    break
  end # end choice

  set_failed_rule :_RawBlockBuilderSelectSub unless _tmp
  return _tmp
end

#_RawBlockElementArgObject

RawBlockElementArg = !“]” (“\]” { “]” } | “\n” { “n” } | < NonNewline > { text })



2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
# File 'lib/review/compiler.rb', line 2126

def _RawBlockElementArg

  _save = self.pos
  while true # sequence
    _save1 = self.pos
    _tmp = match_string("]")
    _tmp = _tmp ? nil : true
    self.pos = _save1
    unless _tmp
      self.pos = _save
      break
    end

    _save2 = self.pos
    while true # choice

      _save3 = self.pos
      while true # sequence
        _tmp = match_string("\\]")
        unless _tmp
          self.pos = _save3
          break
        end
        @result = begin;  "]" ; end
        _tmp = true
        unless _tmp
          self.pos = _save3
        end
        break
      end # end sequence

      break if _tmp
      self.pos = _save2

      _save4 = self.pos
      while true # sequence
        _tmp = match_string("\\n")
        unless _tmp
          self.pos = _save4
          break
        end
        @result = begin;  "\n" ; end
        _tmp = true
        unless _tmp
          self.pos = _save4
        end
        break
      end # end sequence

      break if _tmp
      self.pos = _save2

      _save5 = self.pos
      while true # sequence
        _text_start = self.pos
        _tmp = apply(:_NonNewline)
        if _tmp
          text = get_text(_text_start)
        end
        unless _tmp
          self.pos = _save5
          break
        end
        @result = begin;  text ; end
        _tmp = true
        unless _tmp
          self.pos = _save5
        end
        break
      end # end sequence

      break if _tmp
      self.pos = _save2
      break
    end # end choice

    unless _tmp
      self.pos = _save
    end
    break
  end # end sequence

  set_failed_rule :_RawBlockElementArg unless _tmp
  return _tmp
end

#_RawInlineElementObject

RawInlineElement = “@<raw>RawBlockBuilderSelect?:builders RawInlineElementContent+:c “” builders, position, c)



4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
# File 'lib/review/compiler.rb', line 4123

def _RawInlineElement

  _save = self.pos
  while true # sequence
    _tmp = match_string("@<raw>{")
    unless _tmp
      self.pos = _save
      break
    end
    _save1 = self.pos
    _tmp = apply(:_RawBlockBuilderSelect)
    @result = nil unless _tmp
    unless _tmp
      _tmp = true
      self.pos = _save1
    end
    builders = @result
    unless _tmp
      self.pos = _save
      break
    end
    _save2 = self.pos
    _ary = []
    _tmp = apply(:_RawInlineElementContent)
    if _tmp
      _ary << @result
      while true
        _tmp = apply(:_RawInlineElementContent)
        _ary << @result if _tmp
        break unless _tmp
      end
      _tmp = true
      @result = _ary
    else
      self.pos = _save2
    end
    c = @result
    unless _tmp
      self.pos = _save
      break
    end
    _tmp = match_string("}")
    unless _tmp
      self.pos = _save
      break
    end
    @result = begin; raw(self, builders, position, c); end
    _tmp = true
    unless _tmp
      self.pos = _save
    end
    break
  end # end sequence

  set_failed_rule :_RawInlineElement unless _tmp
  return _tmp
end

#_RawInlineElementContentObject

RawInlineElementContent = (“\}” { “}” } | < /[^rn}]/ > { text })



4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
# File 'lib/review/compiler.rb', line 4182

def _RawInlineElementContent

  _save = self.pos
  while true # choice

    _save1 = self.pos
    while true # sequence
      _tmp = match_string("\\}")
      unless _tmp
        self.pos = _save1
        break
      end
      @result = begin;  "}" ; end
      _tmp = true
      unless _tmp
        self.pos = _save1
      end
      break
    end # end sequence

    break if _tmp
    self.pos = _save

    _save2 = self.pos
    while true # sequence
      _text_start = self.pos
      _tmp = scan(/\A(?-mix:[^\r\n\}])/)
      if _tmp
        text = get_text(_text_start)
      end
      unless _tmp
        self.pos = _save2
        break
      end
      @result = begin;  text ; end
      _tmp = true
      unless _tmp
        self.pos = _save2
      end
      break
    end # end sequence

    break if _tmp
    self.pos = _save
    break
  end # end choice

  set_failed_rule :_RawInlineElementContent unless _tmp
  return _tmp
end

#_rootObject

root = Start



1216
1217
1218
1219
1220
# File 'lib/review/compiler.rb', line 1216

def _root
  _tmp = apply(:_Start)
  set_failed_rule :_root unless _tmp
  return _tmp
end

#_SinglelineCommentObject

SinglelineComment = “#@” < NonNewline+ > EOL position, text)



1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
# File 'lib/review/compiler.rb', line 1380

def _SinglelineComment

  _save = self.pos
  while true # sequence
    _tmp = match_string("\#@")
    unless _tmp
      self.pos = _save
      break
    end
    _text_start = self.pos
    _save1 = self.pos
    _tmp = apply(:_NonNewline)
    if _tmp
      while true
        _tmp = apply(:_NonNewline)
        break unless _tmp
      end
      _tmp = true
    else
      self.pos = _save1
    end
    if _tmp
      text = get_text(_text_start)
    end
    unless _tmp
      self.pos = _save
      break
    end
    _tmp = apply(:_EOL)
    unless _tmp
      self.pos = _save
      break
    end
    @result = begin; singleline_comment(self, position, text); end
    _tmp = true
    unless _tmp
      self.pos = _save
    end
    break
  end # end sequence

  set_failed_rule :_SinglelineComment unless _tmp
  return _tmp
end

#_SinglelineContentObject

SinglelineContent = Inline+:c position, c)



3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
# File 'lib/review/compiler.rb', line 3885

def _SinglelineContent

  _save = self.pos
  while true # sequence
    _save1 = self.pos
    _ary = []
    _tmp = apply(:_Inline)
    if _tmp
      _ary << @result
      while true
        _tmp = apply(:_Inline)
        _ary << @result if _tmp
        break unless _tmp
      end
      _tmp = true
      @result = _ary
    else
      self.pos = _save1
    end
    c = @result
    unless _tmp
      self.pos = _save
      break
    end
    @result = begin; singleline_content(self, position, c); end
    _tmp = true
    unless _tmp
      self.pos = _save
    end
    break
  end # end sequence

  set_failed_rule :_SinglelineContent unless _tmp
  return _tmp
end

#_SpaceObject

Space = /[ t]/



4976
4977
4978
4979
4980
# File 'lib/review/compiler.rb', line 4976

def _Space
  _tmp = scan(/\A(?-mix:[ \t])/)
  set_failed_rule :_Space unless _tmp
  return _tmp
end

#_StartObject

Start = &. { @list_stack = Array.new } Document:c { @strategy.ast = c }



1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
# File 'lib/review/compiler.rb', line 1223

def _Start

  _save = self.pos
  while true # sequence
    _save1 = self.pos
    _tmp = get_byte
    self.pos = _save1
    unless _tmp
      self.pos = _save
      break
    end
    @result = begin;  @list_stack = Array.new ; end
    _tmp = true
    unless _tmp
      self.pos = _save
      break
    end
    _tmp = apply(:_Document)
    c = @result
    unless _tmp
      self.pos = _save
      break
    end
    @result = begin;  @strategy.ast = c ; end
    _tmp = true
    unless _tmp
      self.pos = _save
    end
    break
  end # end sequence

  set_failed_rule :_Start unless _tmp
  return _tmp
end

#_UlistObject

Ulist = Indent+:s Bullet+:b Space+ { @list_stack.push(s) } UlistItemBlock:item { if b.size > 1 then item.level = b.size end } (UlistItem | UlistItemMore | NestedList)*:items &{ s == @list_stack.pop } position, items.unshift(item))



2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
# File 'lib/review/compiler.rb', line 2799

def _Ulist

  _save = self.pos
  while true # sequence
    _save1 = self.pos
    _ary = []
    _tmp = apply(:_Indent)
    if _tmp
      _ary << @result
      while true
        _tmp = apply(:_Indent)
        _ary << @result if _tmp
        break unless _tmp
      end
      _tmp = true
      @result = _ary
    else
      self.pos = _save1
    end
    s = @result
    unless _tmp
      self.pos = _save
      break
    end
    _save2 = self.pos
    _ary = []
    _tmp = apply(:_Bullet)
    if _tmp
      _ary << @result
      while true
        _tmp = apply(:_Bullet)
        _ary << @result if _tmp
        break unless _tmp
      end
      _tmp = true
      @result = _ary
    else
      self.pos = _save2
    end
    b = @result
    unless _tmp
      self.pos = _save
      break
    end
    _save3 = self.pos
    _tmp = apply(:_Space)
    if _tmp
      while true
        _tmp = apply(:_Space)
        break unless _tmp
      end
      _tmp = true
    else
      self.pos = _save3
    end
    unless _tmp
      self.pos = _save
      break
    end
    @result = begin;  @list_stack.push(s) ; end
    _tmp = true
    unless _tmp
      self.pos = _save
      break
    end
    _tmp = apply(:_UlistItemBlock)
    item = @result
    unless _tmp
      self.pos = _save
      break
    end
    @result = begin;  if b.size > 1 then item.level = b.size end ; end
    _tmp = true
    unless _tmp
      self.pos = _save
      break
    end
    _ary = []
    while true

      _save5 = self.pos
      while true # choice
        _tmp = apply(:_UlistItem)
        break if _tmp
        self.pos = _save5
        _tmp = apply(:_UlistItemMore)
        break if _tmp
        self.pos = _save5
        _tmp = apply(:_NestedList)
        break if _tmp
        self.pos = _save5
        break
      end # end choice

      _ary << @result if _tmp
      break unless _tmp
    end
    _tmp = true
    @result = _ary
    items = @result
    unless _tmp
      self.pos = _save
      break
    end
    _save6 = self.pos
    _tmp = begin;  s == @list_stack.pop ; end
    self.pos = _save6
    unless _tmp
      self.pos = _save
      break
    end
    @result = begin; ulist(self, position, items.unshift(item)); end
    _tmp = true
    unless _tmp
      self.pos = _save
    end
    break
  end # end sequence

  set_failed_rule :_Ulist unless _tmp
  return _tmp
end

#_UlistItemObject

UlistItem = Indent+:s Bullet Space+ &{ check_indent(s) } UlistItemBlock:item { item }



3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
# File 'lib/review/compiler.rb', line 3299

def _UlistItem

  _save = self.pos
  while true # sequence
    _save1 = self.pos
    _ary = []
    _tmp = apply(:_Indent)
    if _tmp
      _ary << @result
      while true
        _tmp = apply(:_Indent)
        _ary << @result if _tmp
        break unless _tmp
      end
      _tmp = true
      @result = _ary
    else
      self.pos = _save1
    end
    s = @result
    unless _tmp
      self.pos = _save
      break
    end
    _tmp = apply(:_Bullet)
    unless _tmp
      self.pos = _save
      break
    end
    _save2 = self.pos
    _tmp = apply(:_Space)
    if _tmp
      while true
        _tmp = apply(:_Space)
        break unless _tmp
      end
      _tmp = true
    else
      self.pos = _save2
    end
    unless _tmp
      self.pos = _save
      break
    end
    _save3 = self.pos
    _tmp = begin;  check_indent(s) ; end
    self.pos = _save3
    unless _tmp
      self.pos = _save
      break
    end
    _tmp = apply(:_UlistItemBlock)
    item = @result
    unless _tmp
      self.pos = _save
      break
    end
    @result = begin;  item ; end
    _tmp = true
    unless _tmp
      self.pos = _save
    end
    break
  end # end sequence

  set_failed_rule :_UlistItem unless _tmp
  return _tmp
end

#_UlistItemBlockObject

UlistItemBlock = ListItemFirstLine:c ListItemLine*:d position, @list_stack.size, d.unshift©)



3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
# File 'lib/review/compiler.rb', line 3030

def _UlistItemBlock

  _save = self.pos
  while true # sequence
    _tmp = apply(:_ListItemFirstLine)
    c = @result
    unless _tmp
      self.pos = _save
      break
    end
    _ary = []
    while true
      _tmp = apply(:_ListItemLine)
      _ary << @result if _tmp
      break unless _tmp
    end
    _tmp = true
    @result = _ary
    d = @result
    unless _tmp
      self.pos = _save
      break
    end
    @result = begin; ulist_element(self, position, @list_stack.size, d.unshift(c)); end
    _tmp = true
    unless _tmp
      self.pos = _save
    end
    break
  end # end sequence

  set_failed_rule :_UlistItemBlock unless _tmp
  return _tmp
end

#_UlistItemMoreObject

UlistItemMore = Indent+:s Bullet Bullet+:b Space+ &{ check_indent(s) } UlistItemBlock:item { item.level = b.size+1; item }



3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
# File 'lib/review/compiler.rb', line 3209

def _UlistItemMore

  _save = self.pos
  while true # sequence
    _save1 = self.pos
    _ary = []
    _tmp = apply(:_Indent)
    if _tmp
      _ary << @result
      while true
        _tmp = apply(:_Indent)
        _ary << @result if _tmp
        break unless _tmp
      end
      _tmp = true
      @result = _ary
    else
      self.pos = _save1
    end
    s = @result
    unless _tmp
      self.pos = _save
      break
    end
    _tmp = apply(:_Bullet)
    unless _tmp
      self.pos = _save
      break
    end
    _save2 = self.pos
    _ary = []
    _tmp = apply(:_Bullet)
    if _tmp
      _ary << @result
      while true
        _tmp = apply(:_Bullet)
        _ary << @result if _tmp
        break unless _tmp
      end
      _tmp = true
      @result = _ary
    else
      self.pos = _save2
    end
    b = @result
    unless _tmp
      self.pos = _save
      break
    end
    _save3 = self.pos
    _tmp = apply(:_Space)
    if _tmp
      while true
        _tmp = apply(:_Space)
        break unless _tmp
      end
      _tmp = true
    else
      self.pos = _save3
    end
    unless _tmp
      self.pos = _save
      break
    end
    _save4 = self.pos
    _tmp = begin;  check_indent(s) ; end
    self.pos = _save4
    unless _tmp
      self.pos = _save
      break
    end
    _tmp = apply(:_UlistItemBlock)
    item = @result
    unless _tmp
      self.pos = _save
      break
    end
    @result = begin;  item.level = b.size+1; item ; end
    _tmp = true
    unless _tmp
      self.pos = _save
    end
    break
  end # end sequence

  set_failed_rule :_UlistItemMore unless _tmp
  return _tmp
end

#apply(rule) ⇒ Object



302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
# File 'lib/review/compiler.rb', line 302

def apply(rule)
  if m = @memoizations[rule][@pos]
    @pos = m.pos
    if !m.set
      m.left_rec = true
      return nil
    end

    @result = m.result

    return m.ans
  else
    m = MemoEntry.new(nil, @pos)
    @memoizations[rule][@pos] = m
    start_pos = @pos

    ans = __send__ rule

    lr = m.left_rec

    m.move! ans, @pos, @result

    # Don't bother trying to grow the left recursion
    # if it's failing straight away (thus there is no seed)
    if ans and lr
      return grow_lr(rule, nil, start_pos, m)
    else
      return ans
    end

    return ans
  end
end

#apply_with_args(rule, *args) ⇒ Object



267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
# File 'lib/review/compiler.rb', line 267

def apply_with_args(rule, *args)
  memo_key = [rule, args]
  if m = @memoizations[memo_key][@pos]
    @pos = m.pos
    if !m.set
      m.left_rec = true
      return nil
    end

    @result = m.result

    return m.ans
  else
    m = MemoEntry.new(nil, @pos)
    @memoizations[memo_key][@pos] = m
    start_pos = @pos

    ans = __send__ rule, *args

    lr = m.left_rec

    m.move! ans, @pos, @result

    # Don't bother trying to grow the left recursion
    # if it's failing straight away (thus there is no seed)
    if ans and lr
      return grow_lr(rule, args, start_pos, m)
    else
      return ans
    end

    return ans
  end
end

#check_complex_inline_element_symbol(name) ⇒ Object



863
864
865
# File 'lib/review/compiler.rb', line 863

def check_complex_inline_element_symbol(name)
  COMPLEX_INLINE.key?(name.to_sym)
end

#check_indent(s) ⇒ Object



851
852
853
# File 'lib/review/compiler.rb', line 851

def check_indent(s)
  s.size >= @list_stack.last.size
end

#check_inline_element_symbol(name) ⇒ Object



859
860
861
# File 'lib/review/compiler.rb', line 859

def check_inline_element_symbol(name)
  INLINE.key?(name.to_sym)
end

#check_nested_indent(s) ⇒ Object



855
856
857
# File 'lib/review/compiler.rb', line 855

def check_nested_indent(s)
  s.size >= @list_stack.last.size + 2
end

#comment(text) ⇒ Object



713
714
715
# File 'lib/review/compiler.rb', line 713

def comment(text)
  @strategy.comment(text)
end

#compile(chap) ⇒ Object



404
405
406
407
408
# File 'lib/review/compiler.rb', line 404

def compile(chap)
  @chapter = chap
  do_compile
  @strategy.result
end

#compile_block(syntax, args, lines, node) ⇒ Object



783
784
785
786
787
788
789
790
791
# File 'lib/review/compiler.rb', line 783

def compile_block(syntax, args, lines, node)
  node_name = "node_#{syntax.name}".to_sym
  if @strategy.respond_to?(node_name)
    @strategy.__send__(node_name, node)
  else
    args_conv = syntax.parse_args(args)
    @strategy.__send__(syntax.name, (lines || default_block(syntax)), *args_conv)
  end
end

#compile_column(level, label, caption, content) ⇒ Object



667
668
669
670
671
672
673
# File 'lib/review/compiler.rb', line 667

def compile_column(level, label, caption, content)
  buf = ""
  buf << @strategy.__send__("column_begin", level, label, caption)
  buf << content.to_doc
  buf << @strategy.__send__("column_end", level)
  buf
end

#compile_command(name, args, lines, node) ⇒ Object



675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
# File 'lib/review/compiler.rb', line 675

def compile_command(name, args, lines, node)
  syntax = syntax_descriptor(name)
  if !syntax || (!@strategy.respond_to?(syntax.name) && !@strategy.respond_to?("node_#{syntax.name}"))
    error "strategy does not support command: //#{name}"
    compile_unknown_command args, lines
    return
  end
  begin
    syntax.check_args args
  rescue ReVIEW::CompileError => err
    error err.message
    args = ['(NoArgument)'] * syntax.min_argc
  end
  if syntax.block_allowed?
    compile_block(syntax, args, lines, node)
  else
    if lines
      error "block is not allowed for command //#{syntax.name}; ignore"
    end
    compile_single(syntax, args, node)
  end
end

#compile_dlist(content) ⇒ Object



767
768
769
770
771
772
773
774
775
776
# File 'lib/review/compiler.rb', line 767

def compile_dlist(content)
  buf = ""
  buf << @strategy.dl_begin
  content.each do |element|
    buf << @strategy.dt(element.text.to_doc)
    buf << @strategy.dd(element.content.map{|s| s.to_doc})
  end
  buf << @strategy.dl_end
  buf
end

#compile_headline(level, tag, label, caption) ⇒ Object



698
699
700
701
702
703
704
705
706
707
708
709
710
711
# File 'lib/review/compiler.rb', line 698

def compile_headline(level, tag, label, caption)
  buf = ""
  @headline_indexs ||= [0] ## XXX
  caption ||= ""
  caption.strip!
  index = level - 1
  if @headline_indexs.size > (index + 1)
    @headline_indexs = @headline_indexs[0..index]
  end
  @headline_indexs[index] = 0 if @headline_indexs[index].nil?
  @headline_indexs[index] += 1
  buf << @strategy.headline(level, label, caption)
  buf
end

#compile_inline(op, args) ⇒ Object



811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
# File 'lib/review/compiler.rb', line 811

def compile_inline(op, args)
  unless inline_defined?(op)
    raise ReVIEW::CompileError, "no such inline op: #{op}"
  end
  if @strategy.respond_to?("node_inline_#{op}")
    return @strategy.__send__("node_inline_#{op}", args)
  end
  unless @strategy.respond_to?("inline_#{op}")
    raise "strategy does not support inline op: @<#{op}>"
  end
  if !args
    @strategy.__send__("inline_#{op}", "")
  else
    @strategy.__send__("inline_#{op}", *(args.map(&:to_doc)))
  end
#    rescue => err
#      error err.message
end

#compile_olist(content) ⇒ Object



756
757
758
759
760
761
762
763
764
765
# File 'lib/review/compiler.rb', line 756

def compile_olist(content)
  buf0 = ""
  buf0 << @strategy.ol_begin
  content.each do |element|
    ## XXX 1st arg should be String, not Array
    buf0 << @strategy.ol_item(element.to_doc.split(/\n/), element.num)
  end
  buf0 << @strategy.ol_end
  buf0
end

#compile_paragraph(buf) ⇒ Object



830
831
832
# File 'lib/review/compiler.rb', line 830

def compile_paragraph(buf)
  @strategy.paragraph buf
end

#compile_raw(builders, content) ⇒ Object



834
835
836
837
838
839
840
841
# File 'lib/review/compiler.rb', line 834

def compile_raw(builders, content)
  c = @strategy.class.to_s.gsub(/ReVIEW::/, '').gsub(/Builder/, '').downcase
  if !builders || builders.include?(c)
    content.gsub("\\n", "\n")
  else
    ""
  end
end

#compile_single(syntax, args, node) ⇒ Object



800
801
802
803
804
805
806
807
808
# File 'lib/review/compiler.rb', line 800

def compile_single(syntax, args, node)
  node_name = "node_#{syntax.name}".to_sym
  if @strategy.respond_to?(node_name)
    @strategy.__send__(node_name, node)
  else
    args_conv = syntax.parse_args(args)
    @strategy.__send__(syntax.name, *args_conv)
  end
end

#compile_text(text) ⇒ Object



466
467
468
# File 'lib/review/compiler.rb', line 466

def compile_text(text)
  @strategy.nofunc_text(text)
end

#compile_ulist(content) ⇒ Object



717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
# File 'lib/review/compiler.rb', line 717

def compile_ulist(content)
  buf0 = ""
  level = 0
  content.each do |element|
    current_level = element.level
    buf = element.to_doc
    if level == current_level
      buf0 << @strategy.ul_item_end
      # body
      buf0 << @strategy.ul_item_begin([buf])
    elsif level < current_level # down
      level_diff = current_level - level
      level = current_level
      (1..(level_diff - 1)).to_a.reverse_each do |i|
        buf0 << @strategy.ul_begin{i}
        buf0 << @strategy.ul_item_begin([])
      end
      buf0 << @strategy.ul_begin{level}
      buf0 << @strategy.ul_item_begin([buf])
    elsif level > current_level # up
      level_diff = level - current_level
      level = current_level
      (1..level_diff).to_a.reverse_each do |i|
        buf0 << @strategy.ul_item_end
        buf0 << @strategy.ul_end{level + i}
      end
      buf0 << @strategy.ul_item_end
      # body
      buf0 <<@strategy.ul_item_begin([buf])
    end
  end

  (1..level).to_a.reverse_each do |i|
    buf0 << @strategy.ul_item_end
    buf0 << @strategy.ul_end{i}
  end
  buf0
end

#compile_unknown_command(args, lines) ⇒ Object



779
780
781
# File 'lib/review/compiler.rb', line 779

def compile_unknown_command(args, lines)
  @strategy.unknown_command(args, lines)
end

#convert_astObject



417
418
419
420
421
422
423
424
425
426
# File 'lib/review/compiler.rb', line 417

def convert_ast
  ast = @strategy.ast
  convert_column(ast)
  if $DEBUG
    File.open("review-dump.json","w") do |f|
      f.write(ast.to_json)
    end
  end
  @strategy.output << ast.to_doc
end

#convert_column(ast) ⇒ Object



435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
# File 'lib/review/compiler.rb', line 435

def convert_column(ast)
  @column_stack = []
  content = ast.content
  new_content = []
  @current_content = new_content
  content.each do |elem|
    if elem.kind_of?(ReVIEW::HeadlineNode) && elem.cmd && elem.cmd.to_doc == "column"
      flush_column(new_content)
      @current_content = []
      @current_column = ReVIEW::ColumnNode.new(elem.compiler, elem.position, elem.level,
                                              elem.label, elem.content, @current_content)
      next
    elsif elem.kind_of?(ReVIEW::HeadlineNode) && elem.cmd && elem.cmd.to_doc =~ %r|^/|
      cmd_name = elem.cmd.to_doc[1..-1]
      if cmd_name != "column"
        raise ReVIEW::CompileError, "#{cmd_name} is not opened."
      end
      flush_column(new_content)
      @current_content = new_content
      next
    elsif elem.kind_of?(ReVIEW::HeadlineNode) && @current_column && elem.level <= @current_column.level
      flush_column(new_content)
      @current_content = new_content
    end
    @current_content << elem
  end
  flush_column(new_content)
  ast.content = new_content
  ast
end

#current_column(target = pos) ⇒ Object



30
31
32
33
34
35
36
# File 'lib/review/compiler.rb', line 30

def current_column(target=pos)
  if c = string.rindex("\n", target-1)
    return target - c - 1
  end

  target + 1
end

#current_line(target = pos) ⇒ Object



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/review/compiler.rb', line 38

def current_line(target=pos)
  if @sizes_memo.respond_to?(:bsearch)
    offset = @sizes_memo.bsearch{|line, cur_offset| cur_offset >= target}
    if offset
      return offset[0]
    end
  else
    @sizes_memo.each do |line, cur_offset|
      if cur_offset >= target
        return cur_offset
      end
    end
  end

  -1
end

#default_block(syntax) ⇒ Object



793
794
795
796
797
798
# File 'lib/review/compiler.rb', line 793

def default_block(syntax)
  if syntax.block_required?
    error "block is required for //#{syntax.name}; use empty block"
  end
  []
end

#do_compileObject



410
411
412
413
414
415
# File 'lib/review/compiler.rb', line 410

def do_compile
  @strategy.bind self, @chapter, ReVIEW::Location.new(@chapter.basename, self)
  setup_parser(@chapter.content)
  parse()
  convert_ast
end

#error(msg) ⇒ Object



847
848
849
# File 'lib/review/compiler.rb', line 847

def error(msg)
  @strategy.error msg
end

#external_invoke(other, rule, *args) ⇒ Object



248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
# File 'lib/review/compiler.rb', line 248

def external_invoke(other, rule, *args)
  old_pos = @pos
  old_string = @string

  set_string other.string, other.pos

  begin
    if val = __send__(rule, *args)
      other.pos = @pos
      other.result = @result
    else
      other.set_failed_rule "#{self.class}##{rule}"
    end
    val
  ensure
    set_string old_string, old_pos
  end
end

#failure_caretObject



106
107
108
109
110
111
112
# File 'lib/review/compiler.rb', line 106

def failure_caret
  l = current_line @failing_rule_offset
  c = current_column @failing_rule_offset

  line = lines[l-1]
  "#{line}\n#{' ' * (c - 1)}^"
end

#failure_characterObject



114
115
116
117
118
# File 'lib/review/compiler.rb', line 114

def failure_character
  l = current_line @failing_rule_offset
  c = current_column @failing_rule_offset
  lines[l-1][c-1, 1]
end

#failure_infoObject



94
95
96
97
98
99
100
101
102
103
104
# File 'lib/review/compiler.rb', line 94

def failure_info
  l = current_line @failing_rule_offset
  c = current_column @failing_rule_offset

  if @failed_rule.kind_of? Symbol
    info = self.class::Rules[@failed_rule]
    "line #{l}, column #{c}: failed rule '#{info.name}' = '#{info.rendered}'"
  else
    "line #{l}, column #{c}: failed rule '#{@failed_rule}'"
  end
end

#failure_onelineObject



120
121
122
123
124
125
126
127
128
129
130
131
132
# File 'lib/review/compiler.rb', line 120

def failure_oneline
  l = current_line @failing_rule_offset
  c = current_column @failing_rule_offset

  char = lines[l-1][c-1, 1]

  if @failed_rule.kind_of? Symbol
    info = self.class::Rules[@failed_rule]
    "@#{l}:#{c} failed rule '#{info.name}', got '#{char}'"
  else
    "@#{l}:#{c} failed rule '#{@failed_rule}', got '#{char}'"
  end
end

#flush_column(new_content) ⇒ Object



428
429
430
431
432
433
# File 'lib/review/compiler.rb', line 428

def flush_column(new_content)
  if @current_column
    new_content << @current_column
    @current_column = nil
  end
end

#get_byteObject



192
193
194
195
196
197
198
199
200
# File 'lib/review/compiler.rb', line 192

def get_byte
  if @pos >= @string_size
    return nil
  end

  s = @string[@pos].ord
  @pos += 1
  s
end

#get_text(start) ⇒ Object



61
62
63
# File 'lib/review/compiler.rb', line 61

def get_text(start)
  @string[start..@pos-1]
end

#grow_lr(rule, args, start_pos, m) ⇒ Object



336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
# File 'lib/review/compiler.rb', line 336

def grow_lr(rule, args, start_pos, m)
  while true
    @pos = start_pos
    @result = m.result

    if args
      ans = __send__ rule, *args
    else
      ans = __send__ rule
    end
    return nil unless ans

    break if @pos <= m.pos

    m.move! ans, @pos, @result
  end

  @result = m.result
  @pos = m.pos
  return m.ans
end

#inline_defined?(name) ⇒ Boolean

Returns:

  • (Boolean)


569
570
571
# File 'lib/review/compiler.rb', line 569

def inline_defined?(name)
  INLINE.key?(name.to_sym) || COMPLEX_INLINE.key?(name.to_sym)
end

#linesObject



55
56
57
# File 'lib/review/compiler.rb', line 55

def lines
  @lines_memo
end

#match_string(str) ⇒ Object



171
172
173
174
175
176
177
178
179
# File 'lib/review/compiler.rb', line 171

def match_string(str)
  len = str.size
  if @string[pos,len] == str
    @pos += len
    return str
  end

  return nil
end

#parse(rule = nil) ⇒ Object



213
214
215
216
217
218
219
220
221
222
223
224
225
# File 'lib/review/compiler.rb', line 213

def parse(rule=nil)
  # We invoke the rules indirectly via apply
  # instead of by just calling them as methods because
  # if the rules use left recursion, apply needs to
  # manage that.

  if !rule
    apply(:_root)
  else
    method = rule.gsub("-","_hyphen_")
    apply :"_#{method}"
  end
end

#positionObject



867
868
869
# File 'lib/review/compiler.rb', line 867

def position
  Position.new(self)
end

#raise_errorObject

Raises:



137
138
139
# File 'lib/review/compiler.rb', line 137

def raise_error
  raise ParseError, failure_oneline
end

#scan(reg) ⇒ Object



181
182
183
184
185
186
187
188
189
# File 'lib/review/compiler.rb', line 181

def scan(reg)
  if m = reg.match(@string[@pos..-1])
    width = m.end(0)
    @pos += width
    return true
  end

  return nil
end

#set_failed_rule(name) ⇒ Object



162
163
164
165
166
167
# File 'lib/review/compiler.rb', line 162

def set_failed_rule(name)
  if @pos > @failing_rule_offset
    @failed_rule = name
    @failing_rule_offset = @pos
  end
end

#set_string(string, pos) ⇒ Object

Sets the string and current parsing position for the parser.



66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/review/compiler.rb', line 66

def set_string string, pos
  @string = string.freeze
  @pos = pos
  @sizes_memo = []
  if string
    @string_size = string.size
    @lines_memo = string.lines
    cur_offset = cur_line = 0
    @lines_memo.each do |line|
      cur_line += 1
      cur_offset += line.size
      @sizes_memo << [cur_line, cur_offset]
    end
  else
    @string_size = 0
    @lines_memo = []
  end
end

#setup_foreign_grammarObject



1213
# File 'lib/review/compiler.rb', line 1213

def setup_foreign_grammar; end

#setup_parser(str, debug = false) ⇒ Object

Prepares for parsing str. If you define a custom initialize you must call this method before #parse



16
17
18
19
20
21
22
23
24
# File 'lib/review/compiler.rb', line 16

def setup_parser(str, debug=false)
  set_string str, 0
  @memoizations = Hash.new { |h,k| h[k] = {} }
  @result = nil
  @failed_rule = nil
  @failing_rule_offset = -1

  setup_foreign_grammar
end

#show_error(io = STDOUT) ⇒ Object



141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
# File 'lib/review/compiler.rb', line 141

def show_error(io=STDOUT)
  error_pos = @failing_rule_offset
  line_no = current_line(error_pos)
  col_no = current_column(error_pos)

  io.puts "On line #{line_no}, column #{col_no}:"

  if @failed_rule.kind_of? Symbol
    info = self.class::Rules[@failed_rule]
    io.puts "Failed to match '#{info.rendered}' (rule '#{info.name}')"
  else
    io.puts "Failed to match rule '#{@failed_rule}'"
  end

  io.puts "Got: #{string[error_pos,1].inspect}"
  line = lines[line_no-1]
  io.puts "=> #{line}"
  io.print(" " * (col_no + 3))
  io.puts "^"
end

#show_posObject



85
86
87
88
89
90
91
92
# File 'lib/review/compiler.rb', line 85

def show_pos
  width = 10
  if @pos < width
    "#{@pos} (\"#{@string[0,@pos]}\" @ \"#{@string[@pos,width]}\")"
  else
    "#{@pos} (\"... #{@string[@pos - width, width]}\" @ \"#{@string[@pos,width]}\")"
  end
end

#syntax_defined?(name) ⇒ Boolean

Returns:

  • (Boolean)


542
543
544
# File 'lib/review/compiler.rb', line 542

def syntax_defined?(name)
  SYNTAX.key?(name.to_sym)
end

#syntax_descriptor(name) ⇒ Object



546
547
548
# File 'lib/review/compiler.rb', line 546

def syntax_descriptor(name)
  SYNTAX[name.to_sym]
end

#warn(msg) ⇒ Object



843
844
845
# File 'lib/review/compiler.rb', line 843

def warn(msg)
  @strategy.warn msg
end