/** * Parses a string literal. * * @return A string literal. * * @throws SourceCodeException If the next token in the sequence is not a string literal. */ public Term stringLiteral() throws SourceCodeException { Token valToken = consumeToken(STRING_LITERAL); String valWithQuotes = valToken.image; StringLiteral result = new StringLiteral(valWithQuotes.substring(1, valWithQuotes.length() - 1)); // Set the position that the literal was parsed from. SourceCodePosition position = new SourceCodePositionImpl(valToken.beginLine, valToken.beginColumn, valToken.endLine, valToken.endColumn); result.setSourceCodePosition(position); return result; }
/** * Creates a traversable state for the specified label term. * * @param labelTerm The label term to create a traversable state for. */ public LabelState(Functor labelTerm) { this.labelTerm = labelTerm; labelPath = new String[] { ((StringLiteral) labelTerm.getArgument(0)).stringValue() }; isLeaf = labelTerm.getArity() <= 1; }
/** * Parses a string literal. * * @return A string literal. * * @throws SourceCodeException If the next token in the sequence is not a string literal. */ public StringLiteral stringLiteral() throws SourceCodeException { Token valToken = consumeToken(STRING_LITERAL); String valWithQuotes = valToken.image; StringLiteral result = new StringLiteral(valWithQuotes.substring(1, valWithQuotes.length() - 1)); // Set the position that the literal was parsed from. SourceCodePosition position = new SourceCodePositionImpl(valToken.beginLine, valToken.beginColumn, valToken.endLine, valToken.endColumn); result.setSourceCodePosition(position); return result; }
/** * Creates a traversable state for the specified label term. * * @param labelTerm The label term to create a traversable state for. * @param labelPath The label path of the parent state, that this state extends with a child label. */ private LabelState(Functor labelTerm, String[] labelPath) { this.labelTerm = labelTerm; this.labelPath = Arrays.copyOf(labelPath, labelPath.length + 1); this.getLabelPath()[labelPath.length] = ((StringLiteral) labelTerm.getArgument(0)).stringValue(); isLeaf = labelTerm.getArity() <= 1; }
String value = ((StringLiteral) fromTerm).stringValue(); String value = ((StringLiteral) toTerm).stringValue();
String value = ((StringLiteral) fromTerm).stringValue(); from = TimeOnly.parseTime(value); String value = ((StringLiteral) toTerm).stringValue(); to = TimeOnly.parseTime(value);
from = ((StringLiteral) fromTerm).stringValue(); to = ((StringLiteral) toTerm).stringValue();
pattern = ((StringLiteral) regexpTerm).stringValue();
String presentAs = ((StringLiteral) presentAsTerm).stringValue();