/** * @param e The expression * @param message The exception message * * @return A parser exception * * @see JPRAParseErrorCode#BAD_FIELD_NAME */ public static JPRACompilerParseException badFieldName( final SExpressionSymbolType e, final String message) { return new JPRACompilerParseException( e.getLexicalInformation().map(ImmutableLexicalPosition::newFrom), JPRAParseErrorCode.BAD_FIELD_NAME, message); }
/** * @param e The expression * @param message The exception message * * @return A parser exception * * @see JPRAParseErrorCode#DUPLICATE_FIELD_NAME */ public static JPRACompilerParseException duplicateFieldName( final SExpressionSymbolType e, final String message) { return new JPRACompilerParseException( e.getLexicalInformation().map(ImmutableLexicalPosition::newFrom), JPRAParseErrorCode.DUPLICATE_FIELD_NAME, message); }
/** * @param e The expression * @param s The exception message * * @return A parser exception * * @see JPRAParseErrorCode#BAD_TYPE_REFERENCE */ public static JPRACompilerParseException badTypeReference( final SExpressionSymbolType e, final String s) { return new JPRACompilerParseException( e.getLexicalInformation().map(ImmutableLexicalPosition::newFrom), JPRAParseErrorCode.BAD_TYPE_REFERENCE, s); }
/** * @param e The expression * @param message The exception message * * @return A parser exception * * @see JPRAParseErrorCode#UNRECOGNIZED_RECORD_FIELD_KEYWORD */ public static JPRACompilerParseException unrecognizedRecordFieldKeyword( final SExpressionSymbolType e, final String message) { return new JPRACompilerParseException( e.getLexicalInformation().map(ImmutableLexicalPosition::newFrom), JPRAParseErrorCode.UNRECOGNIZED_RECORD_FIELD_KEYWORD, message); }
/** * @param e The expression * @param message The exception message * * @return A parser exception * * @see JPRAParseErrorCode#BAD_PACKAGE_NAME */ public static JPRACompilerParseException badPackageName( final SExpressionSymbolType e, final String message) { return new JPRACompilerParseException( e.getLexicalInformation().map(ImmutableLexicalPosition::newFrom), JPRAParseErrorCode.BAD_PACKAGE_NAME, message); }
/** * @param e The expression * @param s The exception message * * @return A parser exception * * @see JPRAParseErrorCode#UNRECOGNIZED_INTEGER_TYPE_KEYWORD */ public static JPRACompilerParseException unrecognizedIntegerTypeKeyword( final SExpressionSymbolType e, final String s) { return new JPRACompilerParseException( e.getLexicalInformation().map(ImmutableLexicalPosition::newFrom), JPRAParseErrorCode.UNRECOGNIZED_INTEGER_TYPE_KEYWORD, s); }
/** * @param e The expression * @param message The exception message * * @return A parser exception * * @see JPRAParseErrorCode#BAD_TYPE_NAME */ public static JPRACompilerParseException badTypeName( final SExpressionSymbolType e, final String message) { return new JPRACompilerParseException( e.getLexicalInformation().map(ImmutableLexicalPosition::newFrom), JPRAParseErrorCode.BAD_TYPE_NAME, message); }
/** * @param e The expression * @param s The exception message * * @return A parser exception * * @see JPRAParseErrorCode#UNRECOGNIZED_KEYWORD */ public static JPRACompilerParseException unrecognizedKeyword( final SExpressionSymbolType e, final String s) { return new JPRACompilerParseException( e.getLexicalInformation().map(ImmutableLexicalPosition::newFrom), JPRAParseErrorCode.UNRECOGNIZED_KEYWORD, s); }
/** * @param e The expression * @param s The exception message * * @return A parser exception * * @see JPRAParseErrorCode#UNRECOGNIZED_TYPE_KEYWORD */ public static JPRACompilerParseException unrecognizedTypeKeyword( final SExpressionSymbolType e, final String s) { return new JPRACompilerParseException( e.getLexicalInformation().map(ImmutableLexicalPosition::newFrom), JPRAParseErrorCode.UNRECOGNIZED_TYPE_KEYWORD, s); }
/** * @param e The expression * @param s The exception message * * @return A parser exception * * @see JPRAParseErrorCode#UNRECOGNIZED_SIZE_FUNCTION */ public static JPRACompilerParseException unrecognizedSizeFunction( final SExpressionSymbolType e, final String s) { return new JPRACompilerParseException( e.getLexicalInformation().map(ImmutableLexicalPosition::newFrom), JPRAParseErrorCode.UNRECOGNIZED_SIZE_FUNCTION, s); }
/** * @param e The expression * @param message The exception message * * @return A parser exception * * @see JPRAParseErrorCode#UNRECOGNIZED_PACKED_FIELD_KEYWORD */ public static JPRACompilerParseException unrecognizedPackedFieldKeyword( final SExpressionSymbolType e, final String message) { return new JPRACompilerParseException( e.getLexicalInformation().map(ImmutableLexicalPosition::newFrom), JPRAParseErrorCode.UNRECOGNIZED_PACKED_FIELD_KEYWORD, message); } }
/** * @param e The expression * * @return A parser exception * * @see JPRAParseErrorCode#INVALID_INTEGER_CONSTANT */ public static JPRACompilerParseException invalidIntegerConstant( final SExpressionSymbolType e) { final StringBuilder mb = new StringBuilder(256); mb.append(" Expected: An integer constant"); mb.append(System.lineSeparator()); mb.append(" Got: A symbol '"); mb.append(e.getText()); mb.append("'"); final String m = NullCheck.notNull(mb.toString()); return new JPRACompilerParseException( e.getLexicalInformation().map(ImmutableLexicalPosition::newFrom), JPRAParseErrorCode.INVALID_INTEGER_CONSTANT, m); }
/** * @param e The expression * * @return A parser exception * * @see JPRAParseErrorCode#EXPECTED_LIST_GOT_SYMBOL */ public static JPRACompilerParseException expectedListGotSymbol( final SExpressionSymbolType e) { final StringBuilder mb = new StringBuilder(256); mb.append(" Expected: A list"); mb.append(System.lineSeparator()); mb.append(" Got: A symbol '"); mb.append(e.getText()); mb.append("'"); final String m = NullCheck.notNull(mb.toString()); return new JPRACompilerParseException( e.getLexicalInformation().map(ImmutableLexicalPosition::newFrom), JPRAParseErrorCode.EXPECTED_LIST_GOT_SYMBOL, m); }
@Override public TypeReference parseTypeReference( final SExpressionSymbolType se) throws JPRACompilerParseException { NullCheck.notNull(se); final String text = se.getText(); final Optional<ImmutableLexicalPositionType<Path>> lex = se.getLexicalInformation().map(ImmutableLexicalPosition::newFrom); { final Matcher m = JPRAReferenceParser.PATTERN_PT.matcher(text); if (m.matches()) { final PackageNameUnqualified p_name = new PackageNameUnqualified(lex, m.group(1)); final TypeName t_name = new TypeName(lex, m.group(2)); return new TypeReference(Optional.of(p_name), t_name); } } { final Matcher m = TypeName.PATTERN.matcher(text); if (m.matches()) { return new TypeReference(Optional.empty(), new TypeName(lex, text)); } } throw JPRAReferenceParser.badTypeReference(this.serial, se); }
se.getLexicalInformation().map(ImmutableLexicalPosition::newFrom);