クラス TopLevelClass

java.lang.Object
  上位を拡張 TopLevelClass

public class TopLevelClass
extends java.lang.Object

A syntax representation, generated by ¬<><∪∪ (notavaCC) 1.0.2. Licensed under GPL usually.

The fully qualified name of the class is given by ParserDeclaration. The class has the default scope if it is described as $protected. Otherwise, the class is public. If the value of the --target option is less than 1.4, CharSequence and AssertionError are replaced by StringBuffer and RuntimeException.

parseType(java.io.File, java.lang.String) parses a text and generates an abstruct syntax tree. A node of the tree is an instance of sub-types of TopLevelClass.Node.

This class and any nested classes in this class are not synchronized.

導入されたバージョン:
notavaCC 1.0

入れ子のクラスの概要
static interface TopLevelClass.Default
          A namespace for the default implementations.
static class TopLevelClass.LexicalAnalyzer
          Generator of a sequence of TopLevelClass.Tokens.
static interface TopLevelClass.Node
          A node of the abstract syntax tree that is the result of parsing.
protected static class TopLevelClass.NodeInitializationParameters
          Contains private fields that is used in order to create a node.
static class TopLevelClass.ParseException
          Describes a error of a text.
static interface TopLevelClass.Token
          A token, which is a fragment of a parsed text.
static interface TopLevelClass.Type
          An abstract-syntax-tree node Type.
static class TopLevelClass.Visitor
          A visitor.
 
フィールドの概要
static int EOF_TOKEN
          Describes the EOF.
static int TOKEN_TERMINAL
          Describes the terminal symbol TERMINAL.
 
コンストラクタの概要
TopLevelClass()
          Constructs a parser.
 
メソッドの概要
protected  TopLevelClass.LexicalAnalyzer createLexicalAnalyzer(java.lang.String sourceName, java.lang.CharSequence text, int tabStop)
          Creates a lexical analyzer.
protected  TopLevelClass.Node createNode(int symbolID, TopLevelClass.NodeInitializationParameters parameters)
          Creates a node of an abstract syntax tree.
protected  TopLevelClass.Default.Node createNode(int symbolID, TopLevelClass.NodeInitializationParameters parameters, boolean compact)
          Creates a node of an abstract syntax tree.
static void main(java.lang.String[] args)
          Parses the given files and prints the syntax tree (a sample program).
protected  TopLevelClass.Node modifyWholeTree(TopLevelClass.Node root)
          This method is called when an whole abstract syntax tree is built.
 TopLevelClass.Type parseType(java.io.File file, java.lang.String charsetName)
          Parses a Type in the given file.
 TopLevelClass.Type parseType(java.lang.String sourceName, java.lang.CharSequence text, int tabStop)
          Parses a Type in the given text.
 TopLevelClass.Type parseType(java.lang.String sourceName, java.io.File file, java.lang.String charsetName, int tabStop)
          Parses a Type in the given file.
 TopLevelClass.Type parseType(java.lang.String sourceName, java.io.Reader reader, int tabStop)
          Parses a Type in the given character stream.
 TopLevelClass.Type parseType(TopLevelClass.LexicalAnalyzer analyzer)
          Parses the sequence of tokens.
protected  java.lang.CharSequence toCharSequence(java.io.File file, java.lang.String charsetName)
          Gets the java.lang.CharSequence that represents the text in the given file.
protected  java.lang.CharSequence toCharSequence(java.io.Reader reader)
          Gets the java.lang.CharSequence that represents the text from the given character stream.
 
クラス java.lang.Object から継承されたメソッド
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

フィールドの詳細

EOF_TOKEN

public static final int EOF_TOKEN
Describes the EOF.

導入されたバージョン:
notavaCC 1.0
関連項目:
TopLevelClass.Token.getSymbolID(),

TOKEN_TERMINAL

public static final int TOKEN_TERMINAL
Describes the terminal symbol TERMINAL. A TokenDefinition generates this field, and The word TERMINAL is given by IDENITIFIER.

導入されたバージョン:
notavaCC 1.0
関連項目:
TopLevelClass.Token.getSymbolID(),
コンストラクタの詳細

TopLevelClass

public TopLevelClass()
Constructs a parser. ConstructorScope makes the constructor the default scope.

導入されたバージョン:
notavaCC 1.0
メソッドの詳細

createNode

protected TopLevelClass.Node createNode(int symbolID,
                                        TopLevelClass.NodeInitializationParameters parameters)
                                 throws TopLevelClass.ParseException
Creates a node of an abstract syntax tree.

This is a factory method to create a node from the information given by the arguments. The user can override the method in order to customize the node creation.

The type of the node to create is described by symbolID as follows.

symbolIDtype to create
TopLevelClass.Type.ID TopLevelClass.Type

The default implementation by the TopLevelClass is equivalent to createNode(symbolID, parameters, false).

パラメータ:
symbolID - the kind of the node to create.
parameters - the parameters to initialize the node.
戻り値:
a created node.
例外:
TopLevelClass.ParseException - if the text to parse doesn't satisfy some requirements.
導入されたバージョン:
notavaCC 1.0

createNode

protected final TopLevelClass.Default.Node createNode(int symbolID,
                                                      TopLevelClass.NodeInitializationParameters parameters,
                                                      boolean compact)
Creates a node of an abstract syntax tree. The created node is a instance of a class in TopLevelClass.Default.

パラメータ:
symbolID - the kind of the node to create. See createNode(int, TopLevelClass.NodeInitializationParameters).
parameters - the parameters to initialize the node.
compact - if true, the method creates a compact node, which have only labeled children.
戻り値:
a created node.
導入されたバージョン:
notavaCC 1.0

modifyWholeTree

protected TopLevelClass.Node modifyWholeTree(TopLevelClass.Node root)
                                      throws TopLevelClass.ParseException
This method is called when an whole abstract syntax tree is built. The tree this method returns is regarded as the result of parsing.

パラメータ:
root - the root of the tree generated by createNode(int, TopLevelClass.NodeInitializationParameters).
戻り値:
the result of parsing.
例外:
TopLevelClass.ParseException
導入されたバージョン:
notavaCC 1.0

toCharSequence

protected final java.lang.CharSequence toCharSequence(java.io.File file,
                                                      java.lang.String charsetName)
                                               throws java.io.IOException
Gets the java.lang.CharSequence that represents the text in the given file.

パラメータ:
file - a file.
charsetName - the charset name of the file, or null for the default charset.
戻り値:
the java.lang.CharSequence that represents the text in the file.
例外:
java.io.IOException - if some error is occured for the access to the file.
導入されたバージョン:
notavaCC 1.0

toCharSequence

protected final java.lang.CharSequence toCharSequence(java.io.Reader reader)
                                               throws java.io.IOException
Gets the java.lang.CharSequence that represents the text from the given character stream.

This method reads characters from the stream until the end of the stream has been reached, and returns the java.lang.CharSequence that represents the characters.

パラメータ:
reader - a character stream. This method will not close it.
戻り値:
the java.lang.CharSequence that represents the text from the reader.
例外:
java.io.IOException - if some error is occured for the access to the reader.
導入されたバージョン:
notavaCC 1.0

createLexicalAnalyzer

protected TopLevelClass.LexicalAnalyzer createLexicalAnalyzer(java.lang.String sourceName,
                                                              java.lang.CharSequence text,
                                                              int tabStop)
                                                       throws TopLevelClass.ParseException
Creates a lexical analyzer.

This is a factory method to create a lexical analyzer. The user can override the method in order to customize the lexical analysis.

パラメータ:
sourceName - the name of the source, used only to set the result of TopLevelClass.Token.getSourceName().
text - the text to analyze.
tabStop - the number that the tab character advances the cursor to the next column that is a multiple of. tabStop is used only to set the result of TopLevelClass.Token.getColumn().
戻り値:
the lexical analyzer that analyze the text.
例外:
TopLevelClass.ParseException - if the text to parse doesn't satisfy some requirements.
導入されたバージョン:
notavaCC 1.0

parseType

public TopLevelClass.Type parseType(java.io.File file,
                                    java.lang.String charsetName)
                             throws java.io.IOException,
                                    TopLevelClass.ParseException
Parses a Type in the given file.

This method parses a text in the given file according to the grammar whose start symbol is Type. A $parsable nonterminal symbol Type generates this method. If Type is $parsable-protected, this method is protected.

This is equivalent to parseType(file.getPath(), file, charsetName, 8).

パラメータ:
file - the file including the text to parse.
charsetName - the charset name of the file, or null for the default charset.
戻り値:
the abstract syntax tree.
例外:
java.io.IOException - if some error is occured for the access to the file.
TopLevelClass.ParseException - if the text in the file doesn't satisfy some requirements.
導入されたバージョン:
notavaCC 1.0

parseType

public TopLevelClass.Type parseType(java.lang.String sourceName,
                                    java.io.File file,
                                    java.lang.String charsetName,
                                    int tabStop)
                             throws java.io.IOException,
                                    TopLevelClass.ParseException
Parses a Type in the given file.

This method parses a text in the given file according to the grammar whose start symbol is Type. A $parsable nonterminal symbol Type generates this method. If Type is $parsable-protected, this method is protected.

パラメータ:
sourceName - the name of the source, used only to set the result of TopLevelClass.Token.getSourceName().
file - the file including the text to parse.
charsetName - the charset name of the file, or null for the default charset.
tabStop - the number that the tab character advances the cursor to the next column that is a multiple of. tabStop is used only to set the result of TopLevelClass.Token.getColumn().
戻り値:
the abstract syntax tree.
例外:
java.io.IOException - if some error is occured for the access to the file.
TopLevelClass.ParseException - if the text in the file doesn't satisfy some requirements.
導入されたバージョン:
notavaCC 1.0

parseType

public TopLevelClass.Type parseType(java.lang.String sourceName,
                                    java.io.Reader reader,
                                    int tabStop)
                             throws java.io.IOException,
                                    TopLevelClass.ParseException
Parses a Type in the given character stream.

This method reads characters from the stream until the end of the stream has been reached, and parses the text according to the grammar whose start symbol is Type. A $parsable nonterminal symbol Type generates this method. If Type is $parsable-protected, this method is protected.

パラメータ:
sourceName - the name of the source, used only to set the result of TopLevelClass.Token.getSourceName().
reader - a character stream. This method will not close it.
tabStop - the number that the tab character advances the cursor to the next column that is a multiple of. tabStop is used only to set the result of TopLevelClass.Token.getColumn().
戻り値:
the abstract syntax tree.
例外:
java.io.IOException - if some error is occured for the access to the file.
TopLevelClass.ParseException - if the text in the file doesn't satisfy some requirements.
導入されたバージョン:
notavaCC 1.0

parseType

public TopLevelClass.Type parseType(java.lang.String sourceName,
                                    java.lang.CharSequence text,
                                    int tabStop)
                             throws TopLevelClass.ParseException
Parses a Type in the given text.

This method parses the text according to the grammar whose start symbol is Type. A $parsable nonterminal symbol Type generates this method. If Type is $parsable-protected, this method is protected.

パラメータ:
sourceName - the name of the source, used only to set the result of TopLevelClass.Token.getSourceName().
text - the text to parse.
tabStop - the number that the tab character advances the cursor to the next column that is a multiple of. tabStop is used only to set the result of TopLevelClass.Token.getColumn().
戻り値:
the abstract syntax tree.
例外:
TopLevelClass.ParseException - if the text doesn't satisfy some requirements.
導入されたバージョン:
notavaCC 1.0

parseType

public TopLevelClass.Type parseType(TopLevelClass.LexicalAnalyzer analyzer)
                             throws TopLevelClass.ParseException
Parses the sequence of tokens.

This method parses the sequence of the tokens given by the lexical analyzer according to the grammar whose start symbol is Type. A $parsable nonterminal symbol Type generates this method. If Type is $parsable-protected, this method is protected.

パラメータ:
analyzer - the lexical analyzer that gives the sequence of tokens to parse.
戻り値:
the abstract syntax tree.
例外:
TopLevelClass.ParseException - if the sequence of tokens doesn't satisfy some requirements.
導入されたバージョン:
notavaCC 1.0

main

public static void main(java.lang.String[] args)
Parses the given files and prints the syntax tree (a sample program).

This method is generated if there is only one $parsable nonterminal symbol. The specification of this method may be changed in the feature.

パラメータ:
args - the names of the files to parse.
導入されたバージョン:
notavaCC 1.0