Package ptolemy.moml.unit
Class UParser
- java.lang.Object
-
- ptolemy.moml.unit.UParser
-
- All Implemented Interfaces:
UParserConstants
public class UParser extends java.lang.Object implements UParserConstants
This file implements a Unit parser for Ptolemy II using the JavaCC parser generator.- Since:
- Ptolemy II 4.0
- Version:
- UParser.jj,v 1.9 2004/04/14 14:18:38 rowland Exp
- Author:
- Rowland R Johnson
- Pt.AcceptedRating:
- Red (rowland)
- Pt.ProposedRating:
- Red (rowland)
-
-
Field Summary
Fields Modifier and Type Field Description Token
jj_nt
Next token.Token
token
Current token.UParserTokenManager
token_source
Generated Token Manager.
-
Constructor Summary
Constructors Constructor Description UParser()
UParser(java.io.InputStream stream)
Constructor with InputStream.UParser(java.io.InputStream stream, java.lang.String encoding)
Constructor with InputStream and supplied encodingUParser(java.io.Reader stream)
Constructor.UParser(UParserTokenManager tm)
Constructor with generated Token Manager.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
disable_tracing()
Disable tracing.void
enable_tracing()
Enable tracing.UnitEquation
Equation()
java.util.Vector
Equations()
int
exponent()
ParseException
generateParseException()
Generate ParseException.Token
getNextToken()
Get the next Token.Token
getToken(int index)
Get the specific Token.double
number()
java.util.Vector
parseEquations(java.lang.String expression)
Parse a set of equations separated by semicolons.UnitExpr
parseUnitExpr(java.lang.String expression)
Parse a unit expression.void
ReInit(java.io.InputStream stream)
Reinitialise.void
ReInit(java.io.InputStream stream, java.lang.String encoding)
Reinitialise.void
ReInit(java.io.Reader stream)
Reinitialise.void
ReInit(UParserTokenManager tm)
Reinitialise.UnitExpr
uExpr()
Token
unit()
UnitTerm
uTerm()
-
-
-
Field Detail
-
token_source
public UParserTokenManager token_source
Generated Token Manager.
-
token
public Token token
Current token.
-
jj_nt
public Token jj_nt
Next token.
-
-
Constructor Detail
-
UParser
public UParser()
-
UParser
public UParser(java.io.InputStream stream)
Constructor with InputStream.
-
UParser
public UParser(java.io.InputStream stream, java.lang.String encoding)
Constructor with InputStream and supplied encoding
-
UParser
public UParser(java.io.Reader stream)
Constructor.
-
UParser
public UParser(UParserTokenManager tm)
Constructor with generated Token Manager.
-
-
Method Detail
-
parseUnitExpr
public UnitExpr parseUnitExpr(java.lang.String expression) throws ParseException
Parse a unit expression.- Parameters:
expression
-- Throws:
ParseException
- If parsing error is encountered.
-
parseEquations
public java.util.Vector parseEquations(java.lang.String expression) throws ParseException
Parse a set of equations separated by semicolons.- Parameters:
expression
-- Throws:
ParseException
- If parsing error is encountered.
-
uExpr
public final UnitExpr uExpr() throws ParseException
- Throws:
ParseException
-
uTerm
public final UnitTerm uTerm() throws ParseException
- Throws:
ParseException
-
unit
public final Token unit() throws ParseException
- Throws:
ParseException
-
Equations
public final java.util.Vector Equations() throws ParseException
- Throws:
ParseException
-
Equation
public final UnitEquation Equation() throws ParseException
- Throws:
ParseException
-
exponent
public final int exponent() throws ParseException
- Throws:
ParseException
-
number
public final double number() throws ParseException
- Throws:
ParseException
-
ReInit
public void ReInit(java.io.InputStream stream)
Reinitialise.
-
ReInit
public void ReInit(java.io.InputStream stream, java.lang.String encoding)
Reinitialise.
-
ReInit
public void ReInit(java.io.Reader stream)
Reinitialise.
-
ReInit
public void ReInit(UParserTokenManager tm)
Reinitialise.
-
getNextToken
public final Token getNextToken()
Get the next Token.
-
getToken
public final Token getToken(int index)
Get the specific Token.
-
generateParseException
public ParseException generateParseException()
Generate ParseException.
-
enable_tracing
public final void enable_tracing()
Enable tracing.
-
disable_tracing
public final void disable_tracing()
Disable tracing.
-
-