Package net.sf.laja.parser.engine2.source

Examples of net.sf.laja.parser.engine2.source.SourceLine


        Range lower = new Range(7, "lower", "a", "z");
        Range upper = new Range(8, "upper", "A", "Z");
        Optional xname = new Optional(9, "xname");
        ElementList lname = new ElementList(10, "lname");
        ElementList uname = new ElementList(11, "uname");
        Str ff = new Str(12, "\"");
        ElementList str = new ElementList(13, "str");
        ElementList reference = new ElementList(14, "reference");
        ElementList variable = new ElementList(15, "variable");
        OrList range1 = new OrList(16, "range1");
        ElementList range = new ElementList(17, "range");
        Str end = new Str(18, "END");
        Str complete = new Str(19, "*");
        ElementList repeats = new ElementList(20, "repeats");
        ElementList valx = new ElementList(21, "valx");
        ElementList marker = new ElementList(22, "marker");
        ElementList valprim = new ElementList(23, "valprim");
        ElementList valpar = new ElementList(24, "valpar");
        ElementList valor = new ElementList(25, "valor");
        ElementList valopt = new ElementList(26, "valopt");
        ElementList valand = new ElementList(27, "valand");
        Repeat valstmt = new Repeat(28, "valstmt");
        ElementList val = new ElementList(29, "val");
        ElementList def = new ElementList(30, "def");
        ElementList classvar = new ElementList(31, "classvar");
        ElementList constructor = new ElementList(32, "constructor");
        ElementList outputclass = new ElementList(33, "outputclass");
        ElementList omarg = new ElementList(34, "omarg");
        ElementList outputmethod = new ElementList(35, "outputmethod");
        ElementList outputvar = new ElementList(36, "outputvar");
        ElementList grammar = new ElementList(37, "grammar");

        // *** Statements ***

        // newline = "\r\n" | "\n"
        newline.add(39, new Str(38, "\r\n"));
        newline.add(41, new Str(40, "\n"));

        // comment = ("/*" [(comment | !"*/")+] "*/") | ("//" [!newline+] newline|END)
        ElementList comment_1 = new ElementList(42, "comment_1");
        comment_1.add(44, new Str(43, "/*"));
        Optional comment_1_1 = new Optional(45, "comment_1_1");
        Repeat comment_1_1_1 = new Repeat(46, "comment_1_1_1");
        OrList comment_1_1_1_1 = new OrList(47, "comment_1_1_1_1");
        comment_1_1_1_1.add(48, comment);
        comment_1_1_1_1.add(50, new Str(49, "*/", NOT));
        comment_1_1_1.add(51, comment_1_1_1_1);
        comment_1_1.add(52, comment_1_1_1);
        comment_1.add(53, comment_1_1);
        comment_1.add(55, new Str(54, "*/"));
        comment.add(56, comment_1);
        ElementList comment_2 = new ElementList(57, "comment_2");
        comment_2.add(59, new Str(58, "//"));
        Optional comment_2_1 = new Optional(60, "comment_2_1");
        Repeat comment_2_1_1 = new Repeat(61, "comment_2_1_1");
        comment_2_1_1.add(62, newline, NOT);
        comment_2_1.add(63, comment_2_1_1);
        comment_2.add(64, comment_2_1);
        OrList comment_2_2 = new OrList(65, "comment_2_2");
        comment_2_2.add(66, newline);
        comment_2_2.add(68, new End(67, "comment_2_2"));
        comment_2.add(69, comment_2_2);
        comment.add(70, comment_2);

        // ws = (newline | " " | "\t" | comment)+
        OrList ws_1 = new OrList(71, "ws_1");
        ws_1.add(72, newline);
        ws_1.add(74, new Str(73, " "));
        ws_1.add(76, new Str(75, "\t"));
        ws_1.add(77, comment);
        ws.add(78, ws_1);

        // s = [ws]
        s.add(79, ws);

        // digit = "0".."9"

        // integer = digit+
        integer.add(80, digit);

        // lower = "a".."z"

        // upper = "A".."Z"

        // xname = [lower|upper|digit]+
        Repeat xname_1 = new Repeat(81, "xname_1");
        OrList xname_1_1 = new OrList(82, "xname_1_1");
        xname_1_1.add(83, lower);
        xname_1_1.add(84, upper);
        xname_1_1.add(85, digit);
        xname_1.add(86, xname_1_1);
        xname.add(87, xname_1);

        // lname = lower xname
        lname.add(88, lower);
        lname.add(89, xname);

        // uname = upper xname
        uname.add(90, upper);
        uname.add(91, xname);

        // ff = "\""

        // str = ff (("\\\"" | !(ff|newline))+):strval ff
        str.add(92, ff);
        Repeat str_1 = new Repeat(93, "str_1");
        OrList str_1_1 = new OrList(94, "str_1_1");
        str_1_1.add(96, new Str(95, "\\\""));
        OrList str_1_1_1 = new OrList(97, "str_1_1_1", NOT);
        str_1_1_1.add(98, ff);
        str_1_1_1.add(99, newline);
        str_1_1.add(100, str_1_1_1);
        str_1.add(101, str_1_1);
        str.add(102, str_1);
        str.add(103, ff);

        // reference = lname
        reference.add(104, lname);

        // variable = "$" lname:name
        variable.add(106, new Str(105, "$"));
        variable.add(107, lname);

        // range1 = integer|str
        range1.add(108, integer);
        range1.add(109, str);

        // range = range1 ".." range1
        range.add(110, range1);
        range.add(112, new Str(111, ".."));
        range.add(113, range1);

        // end = "END"

        // complete = "*"

        // repeats = "#" integer:min [".." (integer|"*"):max]
        repeats.add(115, new Str(114, "#"));
        repeats.add(116, integer);
        Optional repeats_1 = new Optional(117, "repeats_1");
        repeats_1.add(119, new Str(118, ".."));
        OrList repeats_1_1 = new OrList(120, "repeats_1_1");
        repeats_1_1.add(121, integer);
        repeats_1_1.add(123, new Str(122, "*"));
        repeats_1.add(124, repeats_1_1);
        repeats.add(125, repeats_1);

        // valx = [":" lname:varname] ["+":repeat|repeats [":" lname:repeatName]]
        Optional valx_1 = new Optional(126, "valx_1");
        valx_1.add(128, new Str(127, ":"));
        valx_1.add(129, lname);
        valx.add(130, valx_1);
        Optional valx_2 = new Optional(131, "valx_2");
        OrList valx_2_1 = new OrList(132, "valx_2_1");
        valx_2_1.add(134, new Str(133, "+"));
        valx_2_1.add(135, repeats);
        valx_2.add(136, valx_2_1);
        Optional valx_2_2 = new Optional(137, "valx_2_2");
        valx_2_2.add(139, new Str(138, ":"));
        valx_2_2.add(140, lname);
        valx_2.add(141, valx_2_2);
        valx.add(142, valx_2);

        // marker = ":" lname:name
        marker.add(144, new Str(143, ":"));
        marker.add(145, lname);

        // valprim = s ["!":not s] range|integer|str|reference|variable|complete|end valx
        valprim.add(146, s);
        Optional valprim_1 = new Optional(147, "valprim_1");
        valprim_1.add(149, new Str(148, "!"));
        valprim_1.add(150, s);
        valprim.add(151, valprim_1);
        OrList valprim_2 = new OrList(152, "valprim_2");
        valprim_2.add(153, range);
        valprim_2.add(154, integer);
        valprim_2.add(155, str);
        valprim_2.add(156, reference);
        valprim_2.add(157, variable);
        valprim_2.add(158, complete);
        valprim_2.add(159, end);
        valprim.add(160, valprim_2);
        valprim.add(161, valx);

        // valpar = s ["!":not s] ["CS":cs|"CI":ci s] "(" s val s ")" valx
        valpar.add(162, s);
        Optional valpar_1 = new Optional(163, "valpar_1");
        valpar_1.add(165, new Str(164, "!"));
        valpar_1.add(166, s);
        valpar.add(167, valpar_1);
        Optional valpar_2 = new Optional(168, "valpar_2");
        OrList valpar_2_1 = new OrList(169, "valpar_2_1");
        valpar_2_1.add(171, new Str(170, "CS"));
        valpar_2_1.add(173, new Str(172, "CI"));
        valpar_2.add(174, valpar_2_1);
        valpar_2.add(175, s);
        valpar.add(176, valpar_2);
        valpar.add(178, new Str(177, "("));
        valpar.add(179, s);
        valpar.add(180, val);
        valpar.add(181, s);
        valpar.add(183, new Str(182, ")"));
        valpar.add(184, valx);

        // valor = s valprim|valpar [s "|" s valprim|valpar]+
        valor.add(185, s);
        OrList valor_1 = new OrList(186, "valor_1");
        valor_1.add(187, valprim);
        valor_1.add(188, valpar);
        valor.add(189, valor_1);
        Optional valor_2 = new Optional(190, "valor_2");
        Repeat valor_2_1 = new Repeat(191, "valor_2_1");
        valor_2_1.add(192, s);
        valor_2_1.add(194, new Str(193, "|"));
        valor_2_1.add(195, s);
        OrList valor_2_1_1 = new OrList(196, "valor_2_1_1");
        valor_2_1_1.add(197, valprim);
        valor_2_1_1.add(198, valpar);
        valor_2_1.add(199, valor_2_1_1);
        valor_2.add(200, valor_2_1);
        valor.add(201, valor_2);

        // valopt = s "[" s val s "]" valx
        valopt.add(202, s);
        valopt.add(204, new Str(203, "["));
        valopt.add(205, s);
        valopt.add(206, val);
        valopt.add(207, s);
        valopt.add(209, new Str(208, "]"));
        valopt.add(210, valx);

        // valand = valor:mainAnd s "&" s valor|valopt [s "&" s valor|valopt]+
        valand.add(211, valor);
        valand.add(212, s);
        valand.add(214, new Str(213, "&"));
        valand.add(215, s);
        OrList valand_1 = new OrList(216, "valand_1");
        valand_1.add(217, valor);
        valand_1.add(218, valopt);
        valand.add(219, valand_1);
        Optional valand_2 = new Optional(220, "valand_2");
        Repeat valand_2_1 = new Repeat(221, "valand_2_1");
        valand_2_1.add(222, s);
        valand_2_1.add(224, new Str(223, "&"));
        valand_2_1.add(225, s);
        OrList valand_2_1_1 = new OrList(226, "valand_2_1_1");
        valand_2_1_1.add(227, valor);
        valand_2_1_1.add(228, valopt);
        valand_2_1.add(229, valand_2_1_1);
        valand_2.add(230, valand_2_1);
        valand.add(231, valand_2);

        // valstmt = (s valand|valor|valopt|marker)+
        valstmt.add(232, s);
        OrList valstmt_1 = new OrList(233, "valstmt_1");
        valstmt_1.add(234, valand);
        valstmt_1.add(235, valor);
        valstmt_1.add(236, valopt);
        valstmt_1.add(237, marker);
        valstmt.add(238, valstmt_1);

        // val = valstmt [s 92 s valstmt:followedby]
        val.add(239, valstmt);
        Optional val_1 = new Optional(240, "val_1");
        val_1.add(241, s);
        val_1.add(243, new Chr(242, (char)92));
        val_1.add(244, s);
        val_1.add(245, valstmt);
        val.add(246, val_1);

        // def = lname:var s "=" s val s ";"
        def.add(247, lname);
        def.add(248, s);
        def.add(250, new Str(249, "="));
        def.add(251, s);
        def.add(252, val);
        def.add(253, s);
        def.add(255, new Str(254, ";"));

        // classvar = uname:class ws lname:var
        classvar.add(256, uname);
        classvar.add(257, ws);
        classvar.add(258, lname);

        // constructor = "(" s classvar s ["," s classvar s]+ ")"
        constructor.add(260, new Str(259, "("));
        constructor.add(261, s);
        constructor.add(262, classvar);
        constructor.add(263, s);
        Optional constructor_1 = new Optional(264, "constructor_1");
        Repeat constructor_1_1 = new Repeat(265, "constructor_1_1");
        constructor_1_1.add(267, new Str(266, ","));
        constructor_1_1.add(268, s);
        constructor_1_1.add(269, classvar);
        constructor_1_1.add(270, s);
        constructor_1.add(271, constructor_1_1);
        constructor.add(272, constructor_1);
        constructor.add(274, new Str(273, ")"));

        // outputclass = uname:class [constructor] ws lname:var s ";"
        outputclass.add(275, uname);
        Optional outputclass_1 = new Optional(276, "outputclass_1");
        outputclass_1.add(277, constructor);
        outputclass.add(278, outputclass_1);
        outputclass.add(279, ws);
        outputclass.add(280, lname);
        outputclass.add(281, s);
        outputclass.add(283, new Str(282, ";"));

        // omarg = s "," s "String":str | "Index":index ws lname:arg
        omarg.add(284, s);
        omarg.add(286, new Str(285, ","));
        omarg.add(287, s);
        OrList omarg_1 = new OrList(288, "omarg_1");
        omarg_1.add(290, new Str(289, "String"));
        omarg_1.add(292, new Str(291, "Index"));
        omarg.add(293, omarg_1);
        omarg.add(294, ws);
        omarg.add(295, lname);

        // outputmethod =
        //   [uname:class [constructor] ws] ["$":setter ws] lname:ref "." lname:method s "(" s
        //   (("void":void ws) | ("String":str ws) | ("Index":index ws) | (uname:argclass ws)
        //   [lname:carg "."] (lname|"*"):arg)
        //   [omarg+] s ")" s ";"
        Optional outputmethod_1 = new Optional(296, "outputmethod_1");
        outputmethod_1.add(297, uname);
        Optional outputmethod_1_1 = new Optional(298, "outputmethod_1_1");
        outputmethod_1_1.add(299, constructor);
        outputmethod_1.add(300, outputmethod_1_1);
        outputmethod_1.add(301, ws);
        outputmethod.add(302, outputmethod_1);
        Optional outputmethod_2 = new Optional(303, "outputmethod_2");
        outputmethod_2.add(305, new Str(304, "$"));
        outputmethod_2.add(306, ws);
        outputmethod.add(307, outputmethod_2);
        outputmethod.add(308, lname);
        outputmethod.add(310, new Str(309, "."));
        outputmethod.add(311, lname);
        outputmethod.add(312, s);
        outputmethod.add(314, new Str(313, "("));
        outputmethod.add(315, s);
        ElementList outputmethod_3 = new ElementList(316, "outputmethod_3");
        OrList outputmethod_3_1 = new OrList(317, "outputmethod_3_1");
        ElementList outputmethod_3_1_1 = new ElementList(318, "outputmethod_3_1_1");
        outputmethod_3_1_1.add(320, new Str(319, "void"));
        outputmethod_3_1_1.add(321, ws);
        outputmethod_3_1.add(322, outputmethod_3_1_1);
        ElementList outputmethod_3_1_2 = new ElementList(323, "outputmethod_3_1_2");
        outputmethod_3_1_2.add(325, new Str(324, "String"));
        outputmethod_3_1_2.add(326, ws);
        outputmethod_3_1.add(327, outputmethod_3_1_2);
        ElementList outputmethod_3_1_3 = new ElementList(328, "outputmethod_3_1_3");
        outputmethod_3_1_3.add(330, new Str(329, "Index"));
        outputmethod_3_1_3.add(331, ws);
        outputmethod_3_1.add(332, outputmethod_3_1_3);
        ElementList outputmethod_3_1_4 = new ElementList(333, "outputmethod_3_1_4");
        outputmethod_3_1_4.add(334, uname);
        outputmethod_3_1_4.add(335, ws);
        outputmethod_3_1.add(336, outputmethod_3_1_4);
        outputmethod_3.add(337, outputmethod_3_1);
        Optional outputmethod_3_2 = new Optional(338, "outputmethod_3_2");
        outputmethod_3_2.add(339, lname);
        outputmethod_3_2.add(341, new Str(340, "."));
        outputmethod_3.add(342, outputmethod_3_2);
        OrList outputmethod_3_3 = new OrList(343, "outputmethod_3_3");
        outputmethod_3_3.add(344, lname);
        outputmethod_3_3.add(346, new Str(345, "*"));
        outputmethod_3.add(347, outputmethod_3_3);
        outputmethod.add(348, outputmethod_3);
        Optional outputmethod_4 = new Optional(349, "outputmethod_4");
        Repeat outputmethod_4_1 = new Repeat(350, "outputmethod_4_1");
        outputmethod_4_1.add(351, omarg);
        outputmethod_4.add(352, outputmethod_4_1);
        outputmethod.add(353, outputmethod_4);
        outputmethod.add(354, s);
        outputmethod.add(356, new Str(355, ")"));
        outputmethod.add(357, s);
        outputmethod.add(359, new Str(358, ";"));

        // outputvar =
        //   "$" lname:variable ws "boolean":bool | "String":str ws
        //   lname:ref "." lname:method s "()" s ";"
        outputvar.add(361, new Str(360, "$"));
        outputvar.add(362, lname);
        outputvar.add(363, ws);
        OrList outputvar_1 = new OrList(364, "outputvar_1");
        outputvar_1.add(366, new Str(365, "boolean"));
        outputvar_1.add(368, new Str(367, "String"));
        outputvar.add(369, outputvar_1);
        outputvar.add(370, ws);
        outputvar.add(371, lname);
        outputvar.add(373, new Str(372, "."));
        outputvar.add(374, lname);
        outputvar.add(375, s);
        outputvar.add(377, new Str(376, "()"));
        outputvar.add(378, s);
        outputvar.add(380, new Str(379, ";"));

        // grammar = s "grammar" ws lname:grammarname s "{" s (def|outputclass|outputmethod|outputvar s)+ "}" s
        grammar.add(381, s);
        grammar.add(383, new Str(382, "grammar"));
        grammar.add(384, ws);
        grammar.add(385, lname);
        grammar.add(386, s);
        grammar.add(388, new Str(387, "{"));
        grammar.add(389, s);
        Repeat grammar_1 = new Repeat(390, "grammar_1");
        OrList grammar_1_1 = new OrList(391, "grammar_1_1");
        grammar_1_1.add(392, def);
        grammar_1_1.add(393, outputclass);
        grammar_1_1.add(394, outputmethod);
        grammar_1_1.add(395, outputvar);
        grammar_1.add(396, grammar_1_1);
        grammar_1.add(397, s);
        grammar.add(398, grammar_1);
        grammar.add(400, new Str(399, "}"));
        grammar.add(401, s);

        return new TopElement(data1, grammar);
    }
View Full Code Here


        Data.ConstructorConstructorCodeBlockCodeBlock constructorConstructorCodeBlockCodeBlock = data2.new ConstructorConstructorCodeBlockCodeBlock("constructorConstructorCodeBlockCodeBlock");
        Data.ConstructorConstructorFirstPart constructorConstructorFirstPart = data2.new ConstructorConstructorFirstPart("constructorConstructorFirstPart");
        Data.ConstructorConstructorLastPart constructorConstructorLastPart = data2.new ConstructorConstructorLastPart("constructorConstructorLastPart");

        // *** Declarations ***
        Str constructorComment = new Str(1, "// (constructor)");
        Str endComment = new Str(2, "// (end)");
        ElementList constructorCodeBlock = new ElementList(3, "constructorCodeBlock");
        ElementList constructor = new ElementList(4, "constructor");

        // *** Statements ***

 
View Full Code Here

    private net.sf.laja.parser.engine2.element.Element getGrammar1() {
        // *** Output classes ***

        // *** Declarations ***
        Str constructorComment = new Str(1, "// (constructor)");
        Str endComment = new Str(2, "// (end)");
        ElementList constructorCodeBlock = new ElementList(3, "constructorCodeBlock");
        ElementList constructor = new ElementList(4, "constructor");

        // *** Statements ***

 
View Full Code Here

    t511a.add(204, a);

    // t511 = t511a "." $x
    t511.add(205, t511a, testcaseT511T511a);
    t511.add(207, new Str(206, "."));
    t511.add(209, new Variable(208, "t511", x_getT511a));

    // t512 = a $true !$false
    t512.add(210, a);
    t512.add(212, new Variable(211, "t512", true_getTrue));
    t512.add(214, new Variable(213, "t512", false_getFalse, NOT));

    // testcase =
    //   "111. " t111 cr
    //   "112. " t112 cr
    //   "113. " t113 cr
View Full Code Here

    t511a.add(204, a);

    // t511 = t511a "." $x
    t511.add(205, t511a, testcaseT511T511a);
    t511.add(207, new Str(206, "."));
    t511.add(209, new Variable(208, "t511", x_getT511a));

    // t512 = a $true !$false
    t512.add(210, a);
    t512.add(212, new Variable(211, "t512", true_getTrue));
    t512.add(214, new Variable(213, "t512", false_getFalse, NOT));

    // testcase =
    //   "111. " t111 cr
    //   "112. " t112 cr
    //   "113. " t113 cr
View Full Code Here

    if (result.success()) {
      Grammar grammar = ((ParserFactory)parser.getFactory()).getGrammar();
      return grammar.getGeneratorResult(parsingSettings);
    }
    throw new ParserException("Could not generate grammar: " + result);
  }
View Full Code Here

  public TestcaseParser(ITestcaseFactoryFactory factoryFactory) {
    init(factoryFactory);
  }

  public void init(ITestcaseFactoryFactory factoryFactory) {
    syntaxErrorHandler = new DefaultSyntaxErrorHandler();
    factory1 = factoryFactory.getFactory(PHASE1);
    factory2 = factoryFactory.getFactory(PHASE2);
    data1 = new Data(factory1);
    data2 = new Data(factory2);
  }
View Full Code Here

    public BehaviourParser(IBehaviourFactoryFactory factoryFactory) {
        init(factoryFactory);
    }

    public void init(IBehaviourFactoryFactory factoryFactory) {
        syntaxErrorHandler = new DefaultSyntaxErrorHandler();
        factory1 = factoryFactory.getFactory(PHASE1);
        factory2 = factoryFactory.getFactory(PHASE2);
        data1 = new Data(factory1);
        data2 = new Data(factory2);
    }
View Full Code Here

    public TemplateParser(ITemplateFactoryFactory factoryFactory) {
        init(factoryFactory);
    }

    public void init(ITemplateFactoryFactory factoryFactory) {
        syntaxErrorHandler = new DefaultSyntaxErrorHandler();
        factory1 = factoryFactory.getFactory(PHASE1);
        factory2 = factoryFactory.getFactory(PHASE2);
        data1 = new Data(factory1);
        data2 = new Data(factory2);
    }
View Full Code Here

    public GrammarParser(IGrammarFactoryFactory factoryFactory) {
        init(factoryFactory);
    }

    public void init(IGrammarFactoryFactory factoryFactory) {
        syntaxErrorHandler = new DefaultSyntaxErrorHandler();
        factory1 = factoryFactory.getFactory(PHASE1);
        factory2 = factoryFactory.getFactory(PHASE2);
        data1 = new Data(factory1);
        data2 = new Data(factory2);
    }
View Full Code Here

TOP

Related Classes of net.sf.laja.parser.engine2.source.SourceLine

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.