it.unimo.dbgroup.momis.odli3
Class Parser

java.lang.Object
  extended byit.unimo.dbgroup.momis.odli3.Parser
All Implemented Interfaces:
java.io.Serializable

public class Parser
extends java.lang.Object
implements java.io.Serializable

See Also:
Serialized Form

Field Summary
private  Error _error
          Error support object.
private  TypeContainer _typeContainer
          stream to read from the ODL description.
static short ALL
           
static short AMPER
           
static short AND
           
static short ANY
           
static short ARRAY
           
static short ATTRIBUTE
           
static short BAG
           
static short BOOLEAN
           
static short BOTTOM
           
static short BT
           
static short CANDIDATE_KEY
           
static short CASE
           
static short CHAR
           
static short CharacterLiteral
           
static short COLON
           
static short COMMA
           
static short CONST
           
static short CONTEXT
           
static short DATE
           
static short DEFAULT
           
static short DOT
           
static short DOUBLE
           
static short DOUBLE_COLON
           
static short DOUBLE_LEFT
           
static short DOUBLE_RIGHT
           
static short ENUM
           
static short EQUAL
           
private  java.lang.String err
          Stringa con il testo dell'errore (vuota quando non c'e' errore)
static short EXCEPTION
           
static short EXISTS
           
static short EXTENT
           
static short EXTRULE
           
static short FALSE
           
static short FILE
           
static short FLOAT
           
static short FloatingPtLiteral
           
static short FOR
           
static short FORALL
           
static short FOREIGN_KEY
           
static short GREATEQUAL
           
static short HAT
           
static short Identifier
           
static short IN
           
static short INFINITE
           
static short INOUT
           
static short INT
           
static short INTEGER
           
static short IntegerLiteral
           
static short INTERFACE
           
static short INVERSE
           
static short KEY
           
static short KEYS
           
static short LEFT
           
static short LEPAR
           
static short LESSEQUAL
           
private  long lineNo
          Line parsed.
static short LIST
           
static short LONG
           
static short LPAR
           
static short LRPAR
           
static short MAPPING
           
static short MINUS
           
static short MODULE
           
static short NFRELATIONAL
           
static short NT
           
static short OBJECT
           
static short OCTET
           
private  Schema odli3Schema
          The parser fills ODL data structure starting from this Schema instace.
static short OF
           
static short ON
           
static short ONEWAY
           
static short ORDER_BY
           
static short OUT
           
static short PERCENT
           
static short PERSISTENT
           
static short PLUS
           
static short QUESTION
           
static short RAISES
           
static short RANGE
           
static short READONLY
           
static short REFERENCES
           
static short RELATIONAL
           
static short RELATIONSHIP
           
static short REPAR
           
static short RIGHT
           
static short RPAR
           
static short RRPAR
           
static short RT
           
static short RULE
           
static short SEMI
           
static short SEMISTRUCTURED
           
static short SEQUENCE
           
static short SET
           
static short SHORT
           
static short SLASH
           
static short SOURCE
           
private  java.io.StreamTokenizer st
          stream to read from the ODL description.
(package private)  int stateptr
           
(package private)  int[] statestk
           
static short String
           
static short STRING
           
static short StringLiteral
           
static short STRUCT
           
static short SWITCH
           
static short SYN
           
static short THEN
           
static short TILDE
           
static short TIMES
           
static short TIMESTAMP
           
static short TRANSIENT
           
static short TRUE
           
static short TYPEDEF
           
static short UNION
           
static short UNSIGNED
           
(package private)  int valptr
           
(package private)  Parserval[] valstk
           
static short VERT
           
static short VIEW
           
static short VOID
           
(package private)  int yychar
           
(package private) static short[] yycheck
           
(package private)  boolean yydebug
           
(package private) static short[] yydefred
           
(package private) static short[] yydgoto
           
static short YYERRCODE
           
(package private)  int yyerrflag
           
(package private) static short YYFINAL
           
(package private) static short[] yygindex
           
(package private) static short[] yylen
           
(package private) static short[] yylhs
           
(package private)  Parserval yylval
           
(package private) static short YYMAXTOKEN
           
(package private) static java.lang.String[] yyname
           
(package private)  int yynerrs
           
(package private) static short[] yyrindex
           
(package private) static java.lang.String[] yyrule
           
(package private) static short[] yysindex
           
(package private) static int YYSTACKSIZE
           
(package private) static short[] yytable
           
(package private) static int YYTABLESIZE
           
(package private)  java.lang.String yytext
           
(package private)  Parserval yyval
           
 
Constructor Summary
Parser()
          Constructor: Creates a parser.
Parser(Schema s)
          Constructor: Creates a parser ready do parse into the given schema.
 
Method Summary
(package private)  void debug(java.lang.String msg)
           
(package private)  void dump_stacks(int count)
           
private  void flushTmpTypeContainerTo(TypeContainer t)
          The temporary type container is usefull to collect all type definitios during parsing is flushed into a "stable" TypeContainer
private  Interface getInterface(java.util.Vector list)
          Search for an interface in a source.
 Schema getSchema()
          Restituisce la struttura entry point dal parser.
private  TypeContainer getTmpTypeContainer()
          A temporary type container is usefull to collect all type definitios during parsing.
(package private)  boolean init_stacks()
           
static void main(java.lang.String[] args)
          This method reads an ODLI3 description from the file with the name passed in the first argument.
private  void myDebug(java.lang.String s)
          Routine per la stampa delle informazioni di debug
 boolean parse(java.io.StreamTokenizer st)
          Parse a ODL schema contained in a stream.
 boolean parse(java.lang.String sodl)
          Parse an ODLI3 description from a string.
 boolean parseFile(java.lang.String fileName)
          Parse a ODL schema contained in a file.
 Schema parseNewSchema(java.lang.String sodl)
          Parse an ODLI3 description from a string.
 void setErrorOutStream(java.io.PrintStream errorOutStream)
          Changes the output stream where write error messages.
(package private)  void state_drop(int cnt)
           
(package private)  int state_peek(int relative)
           
(package private)  int state_pop()
           
(package private)  void state_push(int state)
           
private static void uso(java.io.PrintStream out)
          Prints Instructions about how to use this class from command line.
(package private)  void val_drop(int cnt)
           
(package private)  void val_dump()
           
(package private)  void val_init()
           
(package private)  Parserval val_peek(int relative)
           
(package private)  Parserval val_pop()
           
(package private)  void val_push(Parserval val)
           
private  void yyerror(java.lang.String s)
          Routine di gestione errori statndard del parser
private  int yylex()
          Routine di estrazione di un token da StreamTokenizer, l'input avviene da standard input
(package private)  void yylexdebug(int state, int ch)
           
(package private)  int yyparse()
           
private  void yywarning(java.lang.String s)
          Routine di gestione degli avvertimenti statndard
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

yydebug

boolean yydebug

yynerrs

int yynerrs

yyerrflag

int yyerrflag

yychar

int yychar

YYSTACKSIZE

static final int YYSTACKSIZE
See Also:
Constant Field Values

statestk

int[] statestk

stateptr

int stateptr

yytext

java.lang.String yytext

yyval

Parserval yyval

yylval

Parserval yylval

valstk

Parserval[] valstk

valptr

int valptr

Identifier

public static final short Identifier
See Also:
Constant Field Values

String

public static final short String
See Also:
Constant Field Values

IntegerLiteral

public static final short IntegerLiteral
See Also:
Constant Field Values

StringLiteral

public static final short StringLiteral
See Also:
Constant Field Values

CharacterLiteral

public static final short CharacterLiteral
See Also:
Constant Field Values

FloatingPtLiteral

public static final short FloatingPtLiteral
See Also:
Constant Field Values

AMPER

public static final short AMPER
See Also:
Constant Field Values

COLON

public static final short COLON
See Also:
Constant Field Values

COMMA

public static final short COMMA
See Also:
Constant Field Values

DOT

public static final short DOT
See Also:
Constant Field Values

DOUBLE_COLON

public static final short DOUBLE_COLON
See Also:
Constant Field Values

DOUBLE_LEFT

public static final short DOUBLE_LEFT
See Also:
Constant Field Values

DOUBLE_RIGHT

public static final short DOUBLE_RIGHT
See Also:
Constant Field Values

EQUAL

public static final short EQUAL
See Also:
Constant Field Values

GREATEQUAL

public static final short GREATEQUAL
See Also:
Constant Field Values

HAT

public static final short HAT
See Also:
Constant Field Values

LEFT

public static final short LEFT
See Also:
Constant Field Values

LEPAR

public static final short LEPAR
See Also:
Constant Field Values

LESSEQUAL

public static final short LESSEQUAL
See Also:
Constant Field Values

LPAR

public static final short LPAR
See Also:
Constant Field Values

LRPAR

public static final short LRPAR
See Also:
Constant Field Values

MINUS

public static final short MINUS
See Also:
Constant Field Values

PERCENT

public static final short PERCENT
See Also:
Constant Field Values

PLUS

public static final short PLUS
See Also:
Constant Field Values

QUESTION

public static final short QUESTION
See Also:
Constant Field Values

REPAR

public static final short REPAR
See Also:
Constant Field Values

RIGHT

public static final short RIGHT
See Also:
Constant Field Values

RPAR

public static final short RPAR
See Also:
Constant Field Values

RRPAR

public static final short RRPAR
See Also:
Constant Field Values

SEMI

public static final short SEMI
See Also:
Constant Field Values

SLASH

public static final short SLASH
See Also:
Constant Field Values

TILDE

public static final short TILDE
See Also:
Constant Field Values

TIMES

public static final short TIMES
See Also:
Constant Field Values

VERT

public static final short VERT
See Also:
Constant Field Values

ALL

public static final short ALL
See Also:
Constant Field Values

AND

public static final short AND
See Also:
Constant Field Values

ANY

public static final short ANY
See Also:
Constant Field Values

ARRAY

public static final short ARRAY
See Also:
Constant Field Values

ATTRIBUTE

public static final short ATTRIBUTE
See Also:
Constant Field Values

BAG

public static final short BAG
See Also:
Constant Field Values

BOOLEAN

public static final short BOOLEAN
See Also:
Constant Field Values

BOTTOM

public static final short BOTTOM
See Also:
Constant Field Values

BT

public static final short BT
See Also:
Constant Field Values

CANDIDATE_KEY

public static final short CANDIDATE_KEY
See Also:
Constant Field Values

CASE

public static final short CASE
See Also:
Constant Field Values

CHAR

public static final short CHAR
See Also:
Constant Field Values

CONST

public static final short CONST
See Also:
Constant Field Values

CONTEXT

public static final short CONTEXT
See Also:
Constant Field Values

DEFAULT

public static final short DEFAULT
See Also:
Constant Field Values

DOUBLE

public static final short DOUBLE
See Also:
Constant Field Values

ENUM

public static final short ENUM
See Also:
Constant Field Values

EXCEPTION

public static final short EXCEPTION
See Also:
Constant Field Values

EXISTS

public static final short EXISTS
See Also:
Constant Field Values

EXTENT

public static final short EXTENT
See Also:
Constant Field Values

EXTRULE

public static final short EXTRULE
See Also:
Constant Field Values

FALSE

public static final short FALSE
See Also:
Constant Field Values

FILE

public static final short FILE
See Also:
Constant Field Values

FLOAT

public static final short FLOAT
See Also:
Constant Field Values

FOR

public static final short FOR
See Also:
Constant Field Values

FORALL

public static final short FORALL
See Also:
Constant Field Values

FOREIGN_KEY

public static final short FOREIGN_KEY
See Also:
Constant Field Values

IN

public static final short IN
See Also:
Constant Field Values

INFINITE

public static final short INFINITE
See Also:
Constant Field Values

INOUT

public static final short INOUT
See Also:
Constant Field Values

INT

public static final short INT
See Also:
Constant Field Values

INTEGER

public static final short INTEGER
See Also:
Constant Field Values

INTERFACE

public static final short INTERFACE
See Also:
Constant Field Values

INVERSE

public static final short INVERSE
See Also:
Constant Field Values

KEY

public static final short KEY
See Also:
Constant Field Values

KEYS

public static final short KEYS
See Also:
Constant Field Values

LIST

public static final short LIST
See Also:
Constant Field Values

LONG

public static final short LONG
See Also:
Constant Field Values

MAPPING

public static final short MAPPING
See Also:
Constant Field Values

MODULE

public static final short MODULE
See Also:
Constant Field Values

NFRELATIONAL

public static final short NFRELATIONAL
See Also:
Constant Field Values

NT

public static final short NT
See Also:
Constant Field Values

OBJECT

public static final short OBJECT
See Also:
Constant Field Values

OCTET

public static final short OCTET
See Also:
Constant Field Values

OF

public static final short OF
See Also:
Constant Field Values

ON

public static final short ON
See Also:
Constant Field Values

ONEWAY

public static final short ONEWAY
See Also:
Constant Field Values

ORDER_BY

public static final short ORDER_BY
See Also:
Constant Field Values

OUT

public static final short OUT
See Also:
Constant Field Values

PERSISTENT

public static final short PERSISTENT
See Also:
Constant Field Values

RAISES

public static final short RAISES
See Also:
Constant Field Values

RANGE

public static final short RANGE
See Also:
Constant Field Values

READONLY

public static final short READONLY
See Also:
Constant Field Values

REFERENCES

public static final short REFERENCES
See Also:
Constant Field Values

RELATIONAL

public static final short RELATIONAL
See Also:
Constant Field Values

RELATIONSHIP

public static final short RELATIONSHIP
See Also:
Constant Field Values

RT

public static final short RT
See Also:
Constant Field Values

RULE

public static final short RULE
See Also:
Constant Field Values

SEMISTRUCTURED

public static final short SEMISTRUCTURED
See Also:
Constant Field Values

SEQUENCE

public static final short SEQUENCE
See Also:
Constant Field Values

SET

public static final short SET
See Also:
Constant Field Values

SHORT

public static final short SHORT
See Also:
Constant Field Values

SOURCE

public static final short SOURCE
See Also:
Constant Field Values

STRING

public static final short STRING
See Also:
Constant Field Values

STRUCT

public static final short STRUCT
See Also:
Constant Field Values

SWITCH

public static final short SWITCH
See Also:
Constant Field Values

SYN

public static final short SYN
See Also:
Constant Field Values

THEN

public static final short THEN
See Also:
Constant Field Values

TRANSIENT

public static final short TRANSIENT
See Also:
Constant Field Values

TRUE

public static final short TRUE
See Also:
Constant Field Values

TYPEDEF

public static final short TYPEDEF
See Also:
Constant Field Values

UNION

public static final short UNION
See Also:
Constant Field Values

UNSIGNED

public static final short UNSIGNED
See Also:
Constant Field Values

VIEW

public static final short VIEW
See Also:
Constant Field Values

VOID

public static final short VOID
See Also:
Constant Field Values

DATE

public static final short DATE
See Also:
Constant Field Values

TIMESTAMP

public static final short TIMESTAMP
See Also:
Constant Field Values

YYERRCODE

public static final short YYERRCODE
See Also:
Constant Field Values

yylhs

static final short[] yylhs

yylen

static final short[] yylen

yydefred

static final short[] yydefred

yydgoto

static final short[] yydgoto

yysindex

static final short[] yysindex

yyrindex

static final short[] yyrindex

yygindex

static final short[] yygindex

YYTABLESIZE

static final int YYTABLESIZE
See Also:
Constant Field Values

yytable

static final short[] yytable

yycheck

static final short[] yycheck

YYFINAL

static final short YYFINAL
See Also:
Constant Field Values

YYMAXTOKEN

static final short YYMAXTOKEN
See Also:
Constant Field Values

yyname

static final java.lang.String[] yyname

yyrule

static final java.lang.String[] yyrule

_typeContainer

private TypeContainer _typeContainer
stream to read from the ODL description.


st

private java.io.StreamTokenizer st
stream to read from the ODL description.


lineNo

private long lineNo
Line parsed. Used to keep trace of the current line parsed.


_error

private Error _error
Error support object.


err

private java.lang.String err
Stringa con il testo dell'errore (vuota quando non c'e' errore)


odli3Schema

private Schema odli3Schema
The parser fills ODL data structure starting from this Schema instace.

Constructor Detail

Parser

public Parser(Schema s)
Constructor: Creates a parser ready do parse into the given schema. Schema references the odli3 data structures.


Parser

public Parser()
Constructor: Creates a parser.

Method Detail

debug

void debug(java.lang.String msg)

val_dump

void val_dump()

state_push

void state_push(int state)

state_pop

int state_pop()

state_drop

void state_drop(int cnt)

state_peek

int state_peek(int relative)

init_stacks

boolean init_stacks()

dump_stacks

void dump_stacks(int count)

val_init

void val_init()

val_push

void val_push(Parserval val)

val_pop

Parserval val_pop()

val_drop

void val_drop(int cnt)

val_peek

Parserval val_peek(int relative)

parse

public boolean parse(java.io.StreamTokenizer st)
              throws OdlException
Parse a ODL schema contained in a stream. Routine di inizializzazione del parser
Il parser funziona sulla StreamTokenizer st .

Returns:
True se la sintassi e' stata riconosciuta correttamente
False altrimenti.
Throws:
OdlException

parseFile

public boolean parseFile(java.lang.String fileName)
Parse a ODL schema contained in a file. Routine di inizializzazione del parser
Il parser funziona sulla StreamTokenizer st .

Parameters:
fileName - the fileName of the ODL schema description.
Returns:
True se la sintassi e' stata riconosciuta correttamente
False altrimenti.

parse

public boolean parse(java.lang.String sodl)
Parse an ODLI3 description from a string.

Parameters:
sodl - the string containing the ODL schema description.
Returns:
true if decription acquired, false if errors occured.

parseNewSchema

public Schema parseNewSchema(java.lang.String sodl)
Parse an ODLI3 description from a string.

Parameters:
sodl - the string containing the ODL schema description.
Returns:
true if decription acquired, false if errors occured.

uso

private static void uso(java.io.PrintStream out)
Prints Instructions about how to use this class from command line.


main

public static void main(java.lang.String[] args)
                 throws java.io.NotSerializableException
This method reads an ODLI3 description from the file with the name passed in the first argument.

Throws:
java.io.NotSerializableException

getSchema

public Schema getSchema()
Restituisce la struttura entry point dal parser.


yylex

private int yylex()
Routine di estrazione di un token da StreamTokenizer, l'input avviene da standard input

Returns:
integer value
0 se eof
-1 se ci sono problemi tockenValue se riconosce un token
Throws:
Lavora - su Output, Input e streamTokenizer see none

yyerror

private void yyerror(java.lang.String s)
Routine di gestione errori statndard del parser

Parameters:
s - messaggio da visualizzare

yywarning

private void yywarning(java.lang.String s)
Routine di gestione degli avvertimenti statndard

Parameters:
s - messaggio da visualizzare

myDebug

private void myDebug(java.lang.String s)
Routine per la stampa delle informazioni di debug

Parameters:
s - messaggio da visualizzare

getInterface

private Interface getInterface(java.util.Vector list)
Search for an interface in a source. Cerca una determinata Classe locale dato il nome e la sorgente di appartenenza.

Parameters:
list - Vettore di due stringhe contenente il nome della sorgente e della classe
Returns:
La Classe locale trovata oppure null

getTmpTypeContainer

private TypeContainer getTmpTypeContainer()
A temporary type container is usefull to collect all type definitios during parsing.


flushTmpTypeContainerTo

private void flushTmpTypeContainerTo(TypeContainer t)
The temporary type container is usefull to collect all type definitios during parsing is flushed into a "stable" TypeContainer


setErrorOutStream

public void setErrorOutStream(java.io.PrintStream errorOutStream)
Changes the output stream where write error messages.


yylexdebug

void yylexdebug(int state,
                int ch)

yyparse

int yyparse()


Universita' di Modena e Reggio Emilia