Search in sources :

Example 11 with PartialParsingPointers

use of org.eclipse.xtext.parser.impl.PartialParsingPointers in project xtext-core by eclipse.

the class PartialParsingPointerExpressionTest method testExpression_3_1.

@Test
public void testExpression_3_1() throws Exception {
    String model = "(a+b+c)*(c/d)";
    PartialParsingPointers parsingPointers = calculatePartialParsingPointers(model, 3, 1);
    checkParseRegionPointers(parsingPointers, "(a+b+c)", "RuleCall", "Parens");
}
Also used : PartialParsingPointers(org.eclipse.xtext.parser.impl.PartialParsingPointers) Test(org.junit.Test)

Example 12 with PartialParsingPointers

use of org.eclipse.xtext.parser.impl.PartialParsingPointers in project xtext-core by eclipse.

the class PartialParsingPointerExpressionTest method testExpression_8_2.

@Test
public void testExpression_8_2() throws Exception {
    String model = "(a+b+c)*(c/d)";
    PartialParsingPointers parsingPointers = calculatePartialParsingPointers(model, 8, 2);
    checkParseRegionPointers(parsingPointers, "(a+b+c)*(c/d)", "ParserRule", "Sequence");
}
Also used : PartialParsingPointers(org.eclipse.xtext.parser.impl.PartialParsingPointers) Test(org.junit.Test)

Example 13 with PartialParsingPointers

use of org.eclipse.xtext.parser.impl.PartialParsingPointers in project xtext-core by eclipse.

the class PartialParsingPointerExpressionTest method testExpression_a_b.

@Test
public void testExpression_a_b() throws Exception {
    String model = "a b";
    PartialParsingPointers parsingPointers = calculatePartialParsingPointers(model, 1, 1);
    checkParseRegionPointers(parsingPointers, "a b", "Action", "Sequence");
}
Also used : PartialParsingPointers(org.eclipse.xtext.parser.impl.PartialParsingPointers) Test(org.junit.Test)

Example 14 with PartialParsingPointers

use of org.eclipse.xtext.parser.impl.PartialParsingPointers in project xtext-core by eclipse.

the class PartialParsingPointerExpressionTest method testExpression_9_2.

@Test
public void testExpression_9_2() throws Exception {
    String model = "(a+b+c)*(c/d)";
    PartialParsingPointers parsingPointers = calculatePartialParsingPointers(model, 9, 2);
    // actual minimal replace region is c/d but this would lead to accidental complexity
    // in the partial parser implementation
    // checkParseRegionPointers(parsingPointers, "c/d", "RuleCall", "Addition");
    checkParseRegionPointers(parsingPointers, "(c/d)", "RuleCall", "Parens");
}
Also used : PartialParsingPointers(org.eclipse.xtext.parser.impl.PartialParsingPointers) Test(org.junit.Test)

Example 15 with PartialParsingPointers

use of org.eclipse.xtext.parser.impl.PartialParsingPointers in project xtext-core by eclipse.

the class PartialParsingPointerLookaheadTest method testLookahead_29.

@Test
public void testLookahead_29() throws Exception {
    String model = "bar a foo bar c b d foo bar b c";
    for (int i = 29; i < model.length(); ++i) {
        PartialParsingPointers parsingPointers = calculatePartialParsingPointers(model, i, 1);
        checkParseRegionPointers(parsingPointers, " c", "RuleCall", "LookAhead4");
    }
}
Also used : PartialParsingPointers(org.eclipse.xtext.parser.impl.PartialParsingPointers) Test(org.junit.Test)

Aggregations

PartialParsingPointers (org.eclipse.xtext.parser.impl.PartialParsingPointers)19 Test (org.junit.Test)16 EObject (org.eclipse.emf.ecore.EObject)2 IReferableElementsUnloader (org.eclipse.xtext.parser.antlr.IReferableElementsUnloader)2 ReplaceRegion (org.eclipse.xtext.util.ReplaceRegion)2 IParseResult (org.eclipse.xtext.parser.IParseResult)1