Package com.puppetlabs.geppetto.pp

Examples of com.puppetlabs.geppetto.pp.VerbatimTE


        if(result == null)
          result = defaultCase(theEObject);
        return result;
      }
      case PPPackage.VERBATIM_TE: {
        VerbatimTE verbatimTE = (VerbatimTE) theEObject;
        T result = caseVerbatimTE(verbatimTE);
        if(result == null)
          result = caseTextExpression(verbatimTE);
        if(result == null)
          result = defaultCase(theEObject);
View Full Code Here


    int idx = 0;
    IValidationAdvisor advisor = advisor();
    ValidationPreference hyphens = advisor.interpolatedNonBraceEnclosedHyphens();
    for(TextExpression te : o.getStringPart()) {
      if(idx > 0 && previous instanceof VariableTE && te instanceof VerbatimTE) {
        VerbatimTE verbatim = (VerbatimTE) te;
        if(verbatim.getText().startsWith("-")) {
          if(hyphens.isWarningOrError()) {
            warningOrError(
              acceptor, hyphens,
              "Interpolation continues past '-' in some puppet 2.7 versions", //
              o, PPPackage.Literals.DOUBLE_QUOTED_STRING__STRING_PART, idx - 1,
View Full Code Here

  }

  @Test
  public void test_Validate_DoubleQuotedString_Ok() {
    DoubleQuotedString ls = pf.createDoubleQuotedString();
    VerbatimTE te = pf.createVerbatimTE();
    ls.getStringPart().add(te);
    te.setText("I am a single quoted string with a tab \\t char");
    tester.validator().checkVerbatimTextExpression(te);
    tester.diagnose().assertOK();

    // -- control char
    te.setText("I am a single quoted string with a tab \t");
    tester.validator().checkVerbatimTextExpression(te);
    tester.diagnose().assertOK();

    // -- new line
    te.setText("I am a single quoted string with a nl \n");
    tester.validator().checkVerbatimTextExpression(te);
    tester.diagnose().assertOK();

    // -- TODO: test NBSP

    // Unicode escapes are not supported as specific escapes as any
    // escaped character is the character itself - \u1234 is simply u1234
    // Should not produce an error or warning for sq string

    // -- unicode escape \\u [hexdigit]{4,4}
    te.setText("\\u1a2b");
    tester.validator().checkVerbatimTextExpression(te);
    tester.diagnose().assertWarning(IPPDiagnostics.ISSUE__UNRECOGNIZED_ESCAPE);

    // -- hex escape \x[hexdigit]{2,3} is not supported
    te.setText("\\x1a");
    tester.validator().checkVerbatimTextExpression(te);
    tester.diagnose().assertWarning(IPPDiagnostics.ISSUE__UNRECOGNIZED_ESCAPE);

    // -- octal escape \[0-7]{3,3}
    te.setText("\\777");
    tester.validator().checkVerbatimTextExpression(te);
    tester.diagnose().assertWarning(IPPDiagnostics.ISSUE__UNRECOGNIZED_ESCAPE);

    // -- meta escape \M-[sourcecharexceptNL]
    te.setText("\\M-A");
    tester.validator().checkVerbatimTextExpression(te);
    tester.diagnose().assertWarning(IPPDiagnostics.ISSUE__UNRECOGNIZED_ESCAPE);

    // -- control escape \c[sourcecharexceptNL] or \C-[sourcecharexceptNL]
    te.setText("\\C-J");
    tester.validator().checkVerbatimTextExpression(te);
    tester.diagnose().assertWarning(IPPDiagnostics.ISSUE__UNRECOGNIZED_ESCAPE);

    te.setText("\\cJ");
    tester.validator().checkVerbatimTextExpression(te);
    tester.diagnose().assertWarning(IPPDiagnostics.ISSUE__UNRECOGNIZED_ESCAPE);

    // -- escaped backslash and quotes as well as any escaped character
    te.setText("\\\\"); // i.e. '\\'
    tester.validator().checkVerbatimTextExpression(te);
    tester.diagnose().assertOK();

    te.setText("\\\""); // i.e. '\"'
    tester.validator().checkVerbatimTextExpression(te);
    tester.diagnose().assertOK();

    te.setText("\\p"); // i.e. '\p'
    tester.validator().checkVerbatimTextExpression(te);
    tester.diagnose().assertWarning(IPPDiagnostics.ISSUE__UNRECOGNIZED_ESCAPE);
  }
View Full Code Here

TOP

Related Classes of com.puppetlabs.geppetto.pp.VerbatimTE

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.