Package org.jparsec
Class Indentation
java.lang.Object
org.jparsec.Indentation
Processes indentation based lexical structure according to the
Off-side rule.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Object
(package private) static final CharPredicate
ACharPredicate
that returns true only if the character isn't line feed andCharacter.isWhitespace(char)
returns true.(package private) static final Pattern
APattern
object that matches one or more whitespace characters or line continuations, where the line feed character ('\n'
) is escaped by the backslash character ('\'
).(package private) static final Pattern
APattern
object that matches a line continuation.private final Object
AParser
that recognizes 1 or more whitespace characters on the same line. -
Constructor Summary
ConstructorsConstructorDescriptionCreates aIndentation
object that generates default indent and outdent tokens.Indentation
(Object indent, Object outdent) Creates anIndentation
object that usesindent
andoutdent
as the token values for indentation and outdentation. -
Method Summary
Modifier and TypeMethodDescriptionanalyzeIndentations
(List<Token> tokens, Object lf) Analyzes indentation by looking at the first token after eachlf
and insertingindent
andoutdent
tokens properly.indent()
AParser
that recognizes the generatedindent
token.AParser
that greedily runstokenizer
, and translates line feed characters ('\n'
) toindent
andoutdent
tokens.private void
outdent()
AParser
that recognizes the generatedoutdent
token.private static Token
pseudoToken
(int index, Object value)
-
Field Details
-
INLINE_WHITESPACE
ACharPredicate
that returns true only if the character isn't line feed andCharacter.isWhitespace(char)
returns true. -
LINE_CONTINUATION
APattern
object that matches a line continuation. i.e. a backslash character ('\'
) followed by some whitespaces and ended by a line feed character ('\n'
). Is useful if the line feed character plays a role in the syntax (as in indentation-sensitive languages) and line continuation is supported. -
INLINE_WHITESPACES
APattern
object that matches one or more whitespace characters or line continuations, where the line feed character ('\n'
) is escaped by the backslash character ('\'
). -
WHITESPACES
AParser
that recognizes 1 or more whitespace characters on the same line. Line continutation (escaped by a backslash character'\'
) is considered the same line. -
indent
-
outdent
-
-
Constructor Details
-
Indentation
Creates anIndentation
object that usesindent
andoutdent
as the token values for indentation and outdentation. -
Indentation
public Indentation()Creates aIndentation
object that generates default indent and outdent tokens.
-
-
Method Details