Package org.eclipse.xtext

Examples of org.eclipse.xtext.Keyword


    // c.setNoSpace().before(ga.getFunctionCallAccess().getRightParenthesisKeyword_1_3());
  }

  protected void ifExpressionConfiguration(FormattingConfig c) {
    PPGrammarAccess ga = (PPGrammarAccess) getGrammarAccess();
    Keyword lbr = ga.getIfExpressionAccess().getLeftCurlyBracketKeyword_2();
    Keyword rbr = ga.getIfExpressionAccess().getRightCurlyBracketKeyword_4();
    c.setLinewrap().after(lbr);
    c.setIndentation(lbr, rbr);
    c.setLinewrap().around(rbr);

    lbr = ga.getElseExpressionAccess().getLeftCurlyBracketKeyword_1();
View Full Code Here


  }

  protected void nodeExpressionConfiguration(FormattingConfig c) {
    PPGrammarAccess ga = (PPGrammarAccess) getGrammarAccess();

    Keyword lbr = ga.getNodeDefinitionAccess().getLeftCurlyBracketKeyword_4();
    Keyword rbr = ga.getNodeDefinitionAccess().getRightCurlyBracketKeyword_6();
    c.setLinewrap().after(lbr);
    c.setLinewrap().around(rbr);
    c.setIndentation(lbr, rbr);
  }
View Full Code Here

      c.setLinewrap().after(colon);
      c.setNoLinewrap().before(colon);
    }
    // + indent the body of the resource expression
    {
      Keyword lbr = ga.getResourceExpressionAccess().getLeftCurlyBracketKeyword_0_1_1();
      Keyword rbr = ga.getResourceExpressionAccess().getRightCurlyBracketKeyword_0_1_3();
      c.setIndentation(lbr, rbr);
      c.setNoLinewrap().before(lbr);
      c.setLinewrap().after(lbr);
      c.setLinewrap().before(rbr);
      c.setLinewrap().after(rbr);
      Keyword endComma = ga.getAttributeOperationsAccess().getCommaKeyword_2();
      c.setLinewrap(1).between(endComma, rbr);
    }
    // repeat for literal class for of the rule
    {
      Keyword lbr = ga.getResourceExpressionAccess().getLeftCurlyBracketKeyword_1_2();
      Keyword rbr = ga.getResourceExpressionAccess().getRightCurlyBracketKeyword_1_4();
      c.setIndentation(lbr, rbr);
      c.setNoLinewrap().before(lbr);
      c.setLinewrap().after(lbr);
      c.setLinewrap().before(rbr);
      c.setLinewrap().after(rbr);
      Keyword endComma = ga.getAttributeOperationsAccess().getCommaKeyword_2();
      c.setLinewrap(1).between(endComma, rbr);
    }

    // + linebreak after «attribute (=>|+>) expr,»
    Keyword comma = ga.getAttributeOperationsAccess().getCommaKeyword_1_0_0();
    c.setNoLinewrap().before(comma);
    c.setLinewrap().after(comma);

    // c.setLinewrap().after(ga.getAttributeOperationsAccess().getCommaKeyword_2());
    // for(Keyword comma : ga.getAttributeOperationsAccess().findKeywords(",")) {
    // if(comma == ga.getAttributeOperationsAccess().get)
    // c.setLinewrap().after(comma);
    // }
    // linebreak after each resource body in a list of resource bodies
    {
      Keyword semi = ga.getResourceExpressionAccess().getSemicolonKeyword_0_1_2_1_0();
      c.setNoLinewrap().before(semi);
      c.setLinewrap(2).after(semi);
      Keyword endSemi = ga.getResourceExpressionAccess().getSemicolonKeyword_0_1_2_2();
      c.setNoLinewrap().before(endSemi);
      c.setLinewrap(1).after(endSemi);
    }
    { // repeat for second group
      Keyword semi = ga.getResourceExpressionAccess().getSemicolonKeyword_1_3_1_0();
      c.setNoLinewrap().before(semi);
      c.setLinewrap(2).after(semi);
      Keyword endSemi = ga.getResourceExpressionAccess().getSemicolonKeyword_1_3_2();
      c.setNoLinewrap().before(endSemi);
      c.setLinewrap(1).after(endSemi);
    }
    // c.setLinewrap(1).between(endSemi, rbr);

    // no wrap when RESOURCE -> RESOURCE is used
    // c.setNoLinewrap().before(ga.getRelationshipExpressionAccess().getOpNameAssignment_1_1());
    c.setNoLinewrap().before(ga.getRelationshipExpressionAccess().getOpNameAssignment_1_1());

    // + indent the list of attribute operations but only when when they have a title
    // TODO: 1.0GA (changing resource expression grammar)
    c.setIndentationIncrement().before(ga.getResourceBodyAccess().getAttributesAssignment_0_2());
    c.setIndentationDecrement().after(ga.getResourceBodyAccess().getAttributesAssignment_0_2());

    // this will always indent even if there is no title
    // c.setIndentationIncrement().before(ga.getAttributeOperationsRule());
    // c.setIndentationDecrement().after(ga.getAttributeOperationsRule());

    // this was workaround for bug in Xtext 1.0
    // for(Assignment theCall : ga.getResourceBodyAccess().findAssignments(ga.getAttributeOperationsRule())) {
    // c.setIndentationIncrement().before(theCall);
    // c.setIndentationDecrement().after(theCall);
    // }

    // No space between the two @@ in a virtual exported resource
    {
      Keyword at1 = ga.getVirtualNameOrReferenceAccess().getCommercialAtKeyword_0();
      RuleCall at2 = ga.getVirtualNameOrReferenceAccess().getExportedATBooleanParserRuleCall_1_0();
      RuleCall value = ga.getVirtualNameOrReferenceAccess().getValueUnionNameOrReferenceParserRuleCall_2_0();

      c.setNoSpace().between(at1, at2);
      c.setNoSpace().between(at1, value);
View Full Code Here

    }
  }

  protected void selectorExpressionConfiguration(FormattingConfig c) {
    PPGrammarAccess ga = (PPGrammarAccess) getGrammarAccess();
    Keyword lbr = ga.getSelectorExpressionAccess().getLeftCurlyBracketKeyword_1_2_0_0();
    Keyword rbr = ga.getSelectorExpressionAccess().getRightCurlyBracketKeyword_1_2_0_4();
    c.setLinewrap().after(lbr);
    c.setLinewrap().before(rbr);
    c.setIndentation(lbr, rbr);
    Keyword comma = ga.getSelectorExpressionAccess().getCommaKeyword_1_2_0_2_0_0();
    // RuleCall endcomma = ga.getSelectorExpressionAccess().getEndCommaParserRuleCall_1_3_0_4_0();

    c.setLinewrap().after(comma);
    c.setLinewrap(1).between(comma, rbr);
    // c.setLinewrap(1).between(endcomma, rbr);
View Full Code Here

TOP

Related Classes of org.eclipse.xtext.Keyword

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.