Class InstructionSequenceBuilder
- java.lang.Object
-
- org.apache.pdfbox.pdmodel.common.function.type4.Parser.AbstractSyntaxHandler
-
- org.apache.pdfbox.pdmodel.common.function.type4.InstructionSequenceBuilder
-
- All Implemented Interfaces:
Parser.SyntaxHandler
public final class InstructionSequenceBuilder extends Parser.AbstractSyntaxHandler
Basic parser for Type 4 functions which is used to build up instruction sequences.
-
-
Field Summary
Fields Modifier and Type Field Description private static java.util.regex.PatternINTEGER_PATTERNprivate InstructionSequencemainSequenceprivate static java.util.regex.PatternREAL_PATTERNprivate java.util.Stack<InstructionSequence>seqStack
-
Constructor Summary
Constructors Modifier Constructor Description privateInstructionSequenceBuilder()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private InstructionSequencegetCurrentSequence()InstructionSequencegetInstructionSequence()Returns the instruction sequence that has been build from the syntactic elements.static InstructionSequenceparse(java.lang.CharSequence text)Parses the given text into an instruction sequence representing a Type 4 function that can be executed.static intparseInt(java.lang.String token)Parses a value of type "int".static floatparseReal(java.lang.String token)Parses a value of type "real".voidtoken(java.lang.CharSequence text)Called when a token is encountered.private voidtoken(java.lang.String token)-
Methods inherited from class org.apache.pdfbox.pdmodel.common.function.type4.Parser.AbstractSyntaxHandler
comment, newLine, whitespace
-
-
-
-
Field Detail
-
INTEGER_PATTERN
private static final java.util.regex.Pattern INTEGER_PATTERN
-
REAL_PATTERN
private static final java.util.regex.Pattern REAL_PATTERN
-
mainSequence
private final InstructionSequence mainSequence
-
seqStack
private final java.util.Stack<InstructionSequence> seqStack
-
-
Method Detail
-
getInstructionSequence
public InstructionSequence getInstructionSequence()
Returns the instruction sequence that has been build from the syntactic elements.- Returns:
- the instruction sequence
-
parse
public static InstructionSequence parse(java.lang.CharSequence text)
Parses the given text into an instruction sequence representing a Type 4 function that can be executed.- Parameters:
text- the Type 4 function text- Returns:
- the instruction sequence
-
getCurrentSequence
private InstructionSequence getCurrentSequence()
-
token
public void token(java.lang.CharSequence text)
Called when a token is encountered. No distinction between operators and values is done here.- Parameters:
text- the token text
-
token
private void token(java.lang.String token)
-
parseInt
public static int parseInt(java.lang.String token)
Parses a value of type "int".- Parameters:
token- the token to be parsed- Returns:
- the parsed value
-
parseReal
public static float parseReal(java.lang.String token)
Parses a value of type "real".- Parameters:
token- the token to be parsed- Returns:
- the parsed value
-
-