[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
gnue/appserver src/_featuretest/GodlParser.py s...
From: |
Daniel E. Baumann |
Subject: |
gnue/appserver src/_featuretest/GodlParser.py s... |
Date: |
Mon, 23 Dec 2002 00:23:11 -0500 |
CVSROOT: /cvsroot/gnue
Module name: gnue
Changes by: Daniel E. Baumann <address@hidden> 02/12/23 00:23:10
Modified files:
appserver/src/_featuretest: GodlParser.py Objects.py OdlLexer.py
OdlParser.py
Added files:
appserver/doc/geasarch: odmg.txt
Log message:
More parser work, needs finishing.
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/appserver/doc/geasarch/odmg.txt?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/appserver/src/_featuretest/GodlParser.py.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/appserver/src/_featuretest/Objects.py.diff?tr1=1.4&tr2=1.5&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/appserver/src/_featuretest/OdlLexer.py.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/appserver/src/_featuretest/OdlParser.py.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
Patches:
Index: gnue/appserver/src/_featuretest/GodlParser.py
diff -c gnue/appserver/src/_featuretest/GodlParser.py:1.3
gnue/appserver/src/_featuretest/GodlParser.py:1.4
*** gnue/appserver/src/_featuretest/GodlParser.py:1.3 Mon Sep 16 00:44:03 2002
--- gnue/appserver/src/_featuretest/GodlParser.py Mon Dec 23 00:23:10 2002
***************
*** 19,25 ****
# write to the Free Software Foundation, Inc., 59 Temple Place
# - Suite 330, Boston, MA 02111-1307, USA.
#
! # $Id: GodlParser.py,v 1.3 2002/09/16 04:44:03 baumannd Exp $
import Objects
from gnue.common import GTypecast, GParser
--- 19,25 ----
# write to the Free Software Foundation, Inc., 59 Temple Place
# - Suite 330, Boston, MA 02111-1307, USA.
#
! # $Id: GodlParser.py,v 1.4 2002/12/23 05:23:10 baumannd Exp $
import Objects
from gnue.common import GTypecast, GParser
***************
*** 30,36 ****
# returns a GodlSpec object.
#######################################################
! def loadDefinition(buffer, connections, initialize=1):
return GParser.loadXMLObject (buffer, xmlGodlHandler, 'GodlSpec',
'odl_specification',
initialize, attributes={})
--- 30,36 ----
# returns a GodlSpec object.
#######################################################
! def loadDefinition(buffer, initialize=1):
return GParser.loadXMLObject (buffer, xmlGodlHandler, 'GodlSpec',
'odl_specification',
initialize, attributes={})
***************
*** 42,245 ****
if xmlElements == None:
! #
! #
! xmlElements = {
'odl_specification':
{
'BaseClass': Objects.GodlSpec,
'Required': 1,
! 'SingleInstance': 0,
! 'ParentTags': (None, 'module',)
},
'odl_definition':
{
'BaseClass': Objects.GodlDefinition,
! 'SingleInstance': 0,
! 'ParentTags': ('odl_specification',)
},
'module':
{
'BaseClass': Objects.GodlModule,
'Attributes':
{
! 'id':
{
'Required': 1,
'Unique': 1,
'Typecast': GTypecast.name
}
},
! 'ParentTags': ('odl_definition',)
},
'typedef':
{
'BaseClass': Objects.GodlTypedef,
! 'SingleInstance': 0,
! 'ParentTags': ('odl_definition',)
},
'struct':
{
'BaseClass': Objects.GodlStruct,
'Attributes':
{
! 'id':
{
'Required': 1,
'Unique': 1,
'Typecast': GTypecast.name
}
},
- 'SingleInstance': 0,
'ParentTags': ('odl_definition',)
},
'union':
{
! 'BaseClass': Objects.GodlStruct,
! 'SingleInstance': 0,
'ParentTags': ('odl_definition',)
},
! # 'field': {
! # 'BaseClass': Objects.GSField,
! # 'Attributes': {
! # 'name': {
! # 'Required': 1,
! # 'Unique': 1,
! # 'Typecast': GTypecast.name },
! # 'description': {
! # 'Typecast': GTypecast.text },
! # 'type': {
! # 'Required': 1,
! # 'Typecast': GTypecast.name },
! # 'size': {
! # 'Typecast': GTypecast.whole },
! # 'nullable': {
! # 'Typecast': GTypecast.boolean,
! # 'Default': 1 },
! # 'default': {
! # 'Typecast': GTypecast.text } },
! #
! # 'ParentTags': ('fields',) },
! #
! # 'primarykey': {
! # 'BaseClass': Objects.GSPrimaryKey,
! # 'SingleInstance': 1,
! # 'Attributes': {
! # 'name': {
! # 'Required': 1,
! # 'Typecast': GTypecast.name } },
! # 'ParentTags': ('table',) },
! #
! # 'pkfield': {
! # 'BaseClass': Objects.GSPKField,
! # 'Attributes': {
! # 'name': {
! # 'Required': 1,
! # 'Typecast': GTypecast.name } },
! # 'ParentTags': ('primarykey',) },
! #
! # 'constraints': {
! # 'BaseClass': Objects.GSConstraints,
! # 'SingleInstance': 1,
! # 'ParentTags': ('table',) },
! #
! # 'constraint': {
! # 'BaseClass': Objects.GSConstraint,
! # 'Attributes': {
! # 'name': {
! # 'Required': 1,
! # 'Typecast': GTypecast.name },
! # 'type': {
! # 'Typecast': GTypecast.name } },
! # 'ParentTags': ('constraints',) },
! #
! # 'constraintfield': {
! # 'BaseClass': Objects.GSConstraintField,
! # 'Attributes': {
! # 'name': {
! # 'Required': 1,
! # 'Typecast': GTypecast.name } },
! # 'ParentTags': ('constraint',) },
! #
! # 'constraintref': {
! # 'BaseClass': Objects.GSConstraintField,
! # 'Attributes': {
! # 'name': {
! # 'Required': 1,
! # 'Typecast': GTypecast.name },
! # 'table': {
! # 'Required': 1,
! # 'Typecast': GTypecast.name } },
! # 'ParentTags': ('constraint',) },
! #
! # 'indexes': {
! # 'BaseClass': Objects.GSIndexes,
! # 'SingleInstance': 1,
! # 'ParentTags': ('table',) },
! # 'index': {
! # 'BaseClass': Objects.GSIndex,
! # 'Attributes': {
! # 'name': {
! # 'Required': 1,
! # 'Typecast': GTypecast.name },
! # 'unique': {
! # 'Typecast': GTypecast.boolean } },
! # 'ParentTags': ('indexes',) },
! #
! # 'indexfield': {
! # 'BaseClass': Objects.GSIndexField,
! # 'Attributes': {
! # 'name': {
! # 'Required': 1,
! # 'Typecast': GTypecast.name } },
! # 'ParentTags': ('index',) },
! #
! # 'data': {
! # 'BaseClass': Objects.GSData,
! # 'SingleInstance': 1,
! # 'ParentTags': ('schema',) },
! #
! # 'tabledata': {
! # 'BaseClass': Objects.GSTableData,
! # 'Attributes': {
! # 'name': {
! # 'Required': 1,
! # 'Typecast': GTypecast.name },
! # 'tablename': {
! # 'Required': 1,
! # 'Typecast': GTypecast.name } },
! # 'ParentTags': ('data',) },
! #
! #
! # 'rows': {
! # 'BaseClass': Objects.GSRows,
! # 'SingleInstance': 1,
! # 'ParentTags': ('tabledata',) },
! #
! # 'row': {
! # 'BaseClass': Objects.GSRow,
! # 'ParentTags': ('rows',) },
! #
! # 'value': {
! # 'BaseClass': Objects.GSValue,
! # 'Attributes': {
! # 'field': {
! # 'Required': 0,
! # 'Typecast': GTypecast.name },
! # 'type': {
! # 'Required': 0,
! # 'Typecast': GTypecast.name,
! # 'Default': 'text' } },
! # 'ParentTags': ('row',),
! # 'MixedContent': 1, },
}
return xmlElements
--- 42,394 ----
if xmlElements == None:
! xmlElements =
! {
'odl_specification':
{
'BaseClass': Objects.GodlSpec,
'Required': 1,
! 'SingleInstance': 1,
! 'ParentTags': (None, , 'odl_definition', 'module',)
},
'odl_definition':
{
'BaseClass': Objects.GodlDefinition,
! 'Required': 1,
! 'SingleInstance' :1,
! 'ParentTags': ('odl_specification',)
},
'module':
{
'BaseClass': Objects.GodlModule,
+ 'Importable': 1,
'Attributes':
{
! 'name':
{
'Required': 1,
'Unique': 1,
'Typecast': GTypecast.name
}
},
! 'ParentTags': ('odl_definition',)
},
'typedef':
{
'BaseClass': Objects.GodlTypedef,
! 'Attributes':
! {
! 'type':
! {
! 'Typecast': GTypecast.text
! }
! },
! 'ParentTags': ('odl_definition',)
},
+ 'alias':
+ {
+ 'BaseClass': Objects.GodlAlias,
+ 'Required': 1,
+ 'Unique': 1,
+ 'Typecast': GTypecast.name
+ },
+
'struct':
{
'BaseClass': Objects.GodlStruct,
'Attributes':
{
! 'name':
{
'Required': 1,
'Unique': 1,
'Typecast': GTypecast.name
}
},
'ParentTags': ('odl_definition',)
},
+ 'members':
+ {
+ 'BaseClass': Objects.GodlMembers,
+ 'SingleInstance' : 1,
+ 'ParentTags': ('struct', 'exception',)
+ },
+
+ 'member':
+ {
+ 'BaseCalss': Objects.GodlMember,
+ 'Attributes':
+ {
+ 'name':
+ {
+ 'Required': 1,
+ 'Unique': 1,
+ 'Typecast': GTypecast.name
+ }
+ },
+ 'ParentTags': ('members',)
+ },
+
'union':
{
! 'BaseClass': Objects.GodlUnion,
! 'Attributes':
! {
! 'name':
! {
! 'Required': 1,
! 'Unique': 1,
! 'Typecast': GTypecast.name
! }
! },
'ParentTags': ('odl_definition',)
},
! 'switch':
! {
! 'BaseClass': Objects.GodlSwitch,
! 'Attributes':
! {
! 'type':
! {
! 'Required': 1,
! 'Typecast': GTypecast.text
! }
! },
! 'SingleInstance': 1,
! 'ParentTags': ('union',)
! },
+ 'case':
+ {
+ 'BaseClass': Objects.GodlCase,
+ 'Attribtes:'
+ {
+ 'label':
+ {
+ 'Required': 1,
+ 'Typecast': GTypecast.text
+ },
+ 'name':
+ {
+ 'Required': 1,
+ 'Unique': 1,
+ 'Typecast': GTypecast.name
+ },
+ },
+ 'ParentTags': ('switch',)
+ },
+ 'default':
+ {
+ 'BaseClass': Objects.GodlDefault,
+ 'Attributes':
+ {
+ 'name':
+ {
+ 'Required': 1,
+ 'Unique': 1,
+ 'Typecast': GTypecast.name
+ }
+ },
+ 'SingleInstance': 1,
+ 'ParentTags': ('switch')
+ },
+
+ 'enum':
+ {
+ 'BaseClass': Objects.GodlEnum,
+ 'Attributes':
+ {
+ 'name':
+ {
+ 'Required': 1,
+ 'Unique': 1,
+ 'Typecast': GTypecast.name
+ }
+ }
+ 'ParentTags': ('odl_definition',)
+ },
+
+ 'element':
+ {
+ 'BaseClass': Objects.GodlElement,
+ 'ParentTags': ('enum',)
+ },
+
+ 'const':
+ {
+ 'BaseClass': Objects.GodlConst,
+ 'Attributes':
+ {
+ 'name':
+ {
+ 'Required': 1
+ 'Unique': 1,
+ 'Typecast': GTypecast.name
+ },
+ 'type:'
+ {
+ 'Required': 1,
+ 'Typecast': GTypecast.text
+ }
+ },
+ 'ParentTags': ('odl_definition',)
+ },
+
+ 'exception':
+ {
+ 'BaseClass': Objects.GodlException,
+ 'Attributes':
+ {
+ 'name':
+ {
+ 'Required': 1,
+ 'Unique': 1
+ 'Typecast': GTypecast.name
+ },
+ 'ParentTags': ('odl_definition', 'interface', 'class',)
+ },
+
+ 'interface':
+ {
+ 'BaseClass': Objects.GodlInterface,
+ 'Attributes':
+ {
+ 'name':
+ {
+ 'Required': 1,
+ 'Unique': 1
+ 'Typecast': GTypecast.name
+ }
+ },
+ 'ParentTags': ('odl_definition',)
+ },
+
+ 'inherits':
+ {
+ 'BaseClass': Objects.GodlInherits
+ 'SingleInstance': 1,
+ 'ParentTags': (interface, class,)
+ }
+
+
+ 'attribute':
+ {
+ 'BaseClass': Objects.GodlAttribute,
+ 'Attributes':
+ {
+ 'name':
+ {
+ 'Required': 1,
+ 'Unique': 1
+ 'Typecast': GTypecast.name
+ },
+
+ 'readonly':
+ {
+ 'Typecast': GTypecast.boolean
+ }
+ },
+ 'ParentTags': ('interface', 'class',)
+ },
+
+ 'operation':
+ {
+ 'BaseClass': Objects.Operation,
+ 'Attributes':
+ {
+ 'name':
+ {
+ 'Required': 1,
+ 'Unique': 1
+ 'Typecast': GTypecast.name
+ }
+ },
+
+ 'class':
+ {
+ 'BaseClass': Objects.GodlClass,
+ 'Attributes':
+ {
+ 'name':
+ {
+ 'Required': 1,
+ 'Unique': 1
+ 'Typecast': GTypecast.name
+ }
+ },
+ 'ParentTags': ('odl_definition',)
+ },
+
+ 'extends':
+ {
+ 'BaseClass': Objects.GodlExtends,
+ 'ParentTags': ('class',)
+ },
+
+ 'extent':
+ {
+ 'BaseClass': Objects.GodlExtent,
+ 'ParentTags': ('class',)
+ },
+
+ 'relationship':
+ {
+ 'BaseClass': Objects.GodlRelationship,
+ 'Attributes':
+ {
+ 'name':
+ {
+ 'Required': 1,
+ 'Unique': 1
+ 'Typecast': GTypecast.name
+ }
+ },
+ 'ParentTags': ('class',)
+ },
+
+ 'target':
+ {
+ 'BaseClass': Objects.GodlTarget,
+ 'ParentTags': ('relationship',)
+ },
+
+ 'inverse':
+ {
+ 'BaseClass': Objects.GodlInverse,
+ 'ParentTags': ('relationship',)
+ },
+
+ 'array':
+ {
+ 'BaseClass': Objects.GodlArray,
+ 'Attributes':
+ {
+ 'size':
+ {
+ 'Typecast': GTypecast.integer
+ }
+ },
+ 'ParentTags': ('typedef', 'array', 'set', 'bag', 'list',
+ 'sequence', 'key', 'value', 'member', 'case',
+ 'default', 'target', 'returns', 'parameter',
+ 'attribute',)
+ },
+
+ 'sequence':
+ {
+ 'BaseClass': Objects.GodlSequence,
+ 'ParentTags': ('typedef', 'array', 'set', 'bag', 'list',
+ 'sequence', 'key', 'value', 'member', 'case',
+ 'default', 'target', 'returns', 'parameter',
+ 'attribute',)
+ }
}
return xmlElements
Index: gnue/appserver/src/_featuretest/Objects.py
diff -c gnue/appserver/src/_featuretest/Objects.py:1.4
gnue/appserver/src/_featuretest/Objects.py:1.5
*** gnue/appserver/src/_featuretest/Objects.py:1.4 Mon Nov 4 14:11:49 2002
--- gnue/appserver/src/_featuretest/Objects.py Mon Dec 23 00:23:10 2002
***************
*** 19,25 ****
# write to the Free Software Foundation, Inc., 59 Temple Place
# - Suite 330, Boston, MA 02111-1307, USA.
#
! # $Id: Objects.py,v 1.4 2002/11/04 19:11:49 jamest Exp $
from gnue.common.GObjects import GObj
from gnue.common.GRootObj import GRootObj
--- 19,25 ----
# write to the Free Software Foundation, Inc., 59 Temple Place
# - Suite 330, Boston, MA 02111-1307, USA.
#
! # $Id: Objects.py,v 1.5 2002/12/23 05:23:10 baumannd Exp $
from gnue.common.GObjects import GObj
from gnue.common.GRootObj import GRootObj
***************
*** 45,70 ****
--- 45,142 ----
def __init__(self, parent):
GodlObject.__init__(self, parent, type='GodlTypedef')
+ class GodlAlias(GodlObject):
+ def __init__(self, parent):
+ Godlbject.__init__(self, parent, type='GodlAlias')
+
class GodlStruct(GodlObject):
def __init__(self, parent):
GodlObject.__init__(self, parent, type='GodlStruct')
+ class GodlMembers(GodlObject):
+ def __init__(self, parent):
+ GodlObject.__init__(self, parent, type='GodlMembers')
+
+ class GodlMember(GodlObject):
+ def __init__(self, parent):
+ GodlObject.__init__(self, parent, type='GodlMember')
+
class GodlUnion(GodlObject):
def __init__(self, parent):
GodlObject.__init__(self, parent, type='GodlUnion')
+ class GodlSwitch(GodlObject):
+ def __init__(self, parent):
+ GodlObject.__init__(self, parent, type='GodlSwitch')
+
+ class GodlCase(GodlObject):
+ def __init__(self, parent):
+ GodlObject.__init__(self, parent, type='GodlCase')
+
+ class GodlDefault(GodlObject):
+ def __inti__(self, parent):
+ GodlObject.__init__(self, parent, type='GodlDefault')
+
class GodlEnum(GodlObject):
def __init__(self, parent):
GodlObject.__init__(self, parent, type='GodlEnum')
+ class GodlElement(GodlObject):
+ def __init__(self, parent):
+ GodlObject.__init__(self, parent, type='GodlElement')
+
+ class GodlConst(GodlObject):
+ def __init__(self, parent):
+ GodlObject.__init__(self, parent, type='GodlConst')
+
class GodlInterface(GodlObject):
def __init__(self, parent):
GodlObject.__init__(self, parent, type='GodlInterface')
+ class GodlInherits(GodlObject):
+ def __init__(self, parent):
+ Godl.__init__(self, parent, type='GodlInherits')
+
+ class GodlAttribute(GodlObject):
+ def __init__(self, parent):
+ GodlObject.__init__(self, parent, type='GodlAttribute')
+
+ class GodlOperation(GodlObject):
+ def __init__(self, parent):
+ GodlObject.__init__(self, parent, type='GodlOperation')
+
class GodlClass(GodlObject):
def __init__(self, parent):
GodlObject.__init__(self, parent, type='GodlClass')
+ class GodlExtends(GodlObject):
+ def __init__(self, parent):
+ GodlObject.__init__(self, parent, type='GodlExtends')
+
+ class GodlExtent(GodlObject):
+ def __init__(self, parent):
+ GodlObject.__init__(self, parent, type='GodlExtent')
+
+ class GodlRelationship(GodlObject):
+ def __init__(self, parent):
+ GodlObject.__init__(self, parent, type='GodlRelationship')
+
+ class GodlTarget(GodlObject):
+ def __init__(self, parent):
+ GodlObject.__init__(self, parent, type='GodlTarget')
+
+ class GodlInverse(GodlObject):
+ def __init__(self, parent):
+ GodlObject.__init__(self, parent, type='GodlInverse')
+
+ class GodlArray(GodlObject):
+ def __init__(self, parent):
+ GodlObject.__init__(self, parent, type='GodlArray')
+
+ class GodlSequence(GodlObject):
+ def __inti__(self, parent):
+ GodlObject.__init__(self, parent, type='GodlSequence')
+
class GodlConst(GodlObject):
def __init__(self, parent):
GodlObject.__init__(self, parent, type='GodlConst')
***************
*** 73,86 ****
def __init__(self, parent):
GodlObject.__init__(self, parent, type='GodlException')
- class GodlAttribute(GodlObject):
- def __init__(self, parent):
- GodlObject.__init__(self, parent, type='GodlAttribute')
-
class GodlRelationship(GodlObject):
def __init__(self, parent):
GodlObject.__init__(self, parent, type='GodlRelationship')
-
- class GodlOperation(GodlObject):
- def __init__(self, parent):
- GodlObject.__init__(self, parent, type='GodlOperation')
--- 145,150 ----
Index: gnue/appserver/src/_featuretest/OdlLexer.py
diff -c gnue/appserver/src/_featuretest/OdlLexer.py:1.3
gnue/appserver/src/_featuretest/OdlLexer.py:1.4
*** gnue/appserver/src/_featuretest/OdlLexer.py:1.3 Wed Oct 9 00:04:31 2002
--- gnue/appserver/src/_featuretest/OdlLexer.py Mon Dec 23 00:23:10 2002
***************
*** 19,25 ****
# write to the Free Software Foundation, Inc., 59 Temple Place
# - Suite 330, Boston, MA 02111-1307, USA.
#
! # $Id: OdlLexer.py,v 1.3 2002/10/09 04:04:31 baumannd Exp $
import lex
--- 19,25 ----
# write to the Free Software Foundation, Inc., 59 Temple Place
# - Suite 330, Boston, MA 02111-1307, USA.
#
! # $Id: OdlLexer.py,v 1.4 2002/12/23 05:23:10 baumannd Exp $
import lex
***************
*** 32,38 ****
'TYPEDEF', 'DATE', 'TIME', 'INTERVAL', 'TIMESTAMP', 'DICTIONARY',
'STRUCT', 'UNION', 'SWITCH', 'CASE', 'DEFAULT', 'ENUM', 'ARRAY',
'SEQUENCE', 'EXCEPTION', 'ONEWAY', 'VOID', 'IN', 'OUT', 'INOUT',
! 'RAISES', 'CONTEXT', 'KEY',
)
tokens = reserved + (
--- 32,38 ----
'TYPEDEF', 'DATE', 'TIME', 'INTERVAL', 'TIMESTAMP', 'DICTIONARY',
'STRUCT', 'UNION', 'SWITCH', 'CASE', 'DEFAULT', 'ENUM', 'ARRAY',
'SEQUENCE', 'EXCEPTION', 'ONEWAY', 'VOID', 'IN', 'OUT', 'INOUT',
! 'RAISES', 'CONTEXT',
)
tokens = reserved + (
***************
*** 43,49 ****
'ADD', 'SUB', 'MULT', 'DIV', 'MOD', 'NOT', 'BANG'
)
! # throw away whitespacex
t_ignore = ' \t'
# Newlines
--- 43,49 ----
'ADD', 'SUB', 'MULT', 'DIV', 'MOD', 'NOT', 'BANG'
)
! # throw away whitespace
t_ignore = ' \t'
# Newlines
Index: gnue/appserver/src/_featuretest/OdlParser.py
diff -c gnue/appserver/src/_featuretest/OdlParser.py:1.1
gnue/appserver/src/_featuretest/OdlParser.py:1.2
*** gnue/appserver/src/_featuretest/OdlParser.py:1.1 Wed Oct 9 00:04:31 2002
--- gnue/appserver/src/_featuretest/OdlParser.py Mon Dec 23 00:23:10 2002
***************
*** 19,46 ****
# write to the Free Software Foundation, Inc., 59 Temple Place
# - Suite 330, Boston, MA 02111-1307, USA.
#
! # $Id: OdlParser.py,v 1.1 2002/10/09 04:04:31 baumannd Exp $
import yacc
# Get the token map from the lexer
from OdlLexer import tokens
def p_start1(t):
'start : specification'
! pass
def p_start2(t):
'start : BANG const_exp'
! pass
def p_specification1(t):
'specification : definition'
! pass
def p_specification2(t):
'specification : definition specification',
! pass
def p_definition(t):
'''definition : type_dcl SEMI
--- 19,57 ----
# write to the Free Software Foundation, Inc., 59 Temple Place
# - Suite 330, Boston, MA 02111-1307, USA.
#
! # $Id: OdlParser.py,v 1.2 2002/12/23 05:23:10 baumannd Exp $
import yacc
# Get the token map from the lexer
from OdlLexer import tokens
+ class Node:
+ def __init__(self, type, children=None, leaf=None):
+ self.type = type
+ if children:
+ self.children = children
+ else:
+ self.children = []
+ self.leaf = leaf
+ def printTree(self):
+ pass
+
def p_start1(t):
'start : specification'
! t[0] = Node(u'START', t[1])
def p_start2(t):
'start : BANG const_exp'
! t[0] = Node(u'START', [t[2]], t[1])
def p_specification1(t):
'specification : definition'
! t[0] = Node(u'SPECIFICATION', t[1])
def p_specification2(t):
'specification : definition specification',
! t[0] = Node(u'SPECIFICATION', [t[1], t[2]])
def p_definition(t):
'''definition : type_dcl SEMI
***************
*** 49,68 ****
| interface SEMI
| module SEMI
| class SEMI'''
! pass
def p_class(t):
'''class : class_dcl
| class_forward_dcl'''
! pass
def p_class_dcl(t):
'class_dcl : class_header LBRACE interface_body RBRACE'
! pass
def p_class_forward_dcl(t):
'class_forward_dcl : CLASS IDENT'
! pass
def p_class_header1(t):
'class_header : CLASS IDENT'
--- 60,79 ----
| interface SEMI
| module SEMI
| class SEMI'''
! t[0] = Node(u'DEFINITION', [t[1]])
def p_class(t):
'''class : class_dcl
| class_forward_dcl'''
! t[0] = Node('CLASS', [t[1]])
def p_class_dcl(t):
'class_dcl : class_header LBRACE interface_body RBRACE'
! t[0] = Node(u'CLASS_DCL', [t[1], t[3]])
def p_class_forward_dcl(t):
'class_forward_dcl : CLASS IDENT'
! t[0] = Node(u'CLASS_FORWARD_DCL', [t[1], t[2]])
def p_class_header1(t):
'class_header : CLASS IDENT'
***************
*** 658,696 ****
pass
def p_except_dcl2(t):
! 'except_dcl : EXCEPT IDENT LBRACE member_list RBRACE'
pass
def p_op_dcl1(t):
! 'op_dcl : op_type_spec IDENT parameter_dcls'
pass
def p_op_dcl2(t):
! 'op_dcl : op_attribute op_type_spec IDENT parameter_dcls'
pass
def p_op_dcl3(t):
! 'op_dcl : op_type_spec IDENT parameter_dcls raises_expr'
pass
def p_op_dcl4(t):
! 'op_dcl : op_attribute op_type_spec IDENT parameter_dcls raises_expr'
pass
def p_op_dcl5(t):
! 'op_dcl : op_type_spec IDENT parameter_dcls context_expr'
pass
def p_op_dcl6(t):
! 'op_dcl : op_attribute op_type_spec IDENT parameter_dcls context_expr'
pass
def p_op_dcl7(t):
! 'op_dcl : op_type_spec IDENT parameter_dcls raises_expr context_expr'
pass
def p_op_dcl8(t):
! 'op_dcl : op_attribute op_type_spec IDENT parameter_dcls raises_expr
context_expr'
pass
def p_op_attribute(t):
--- 669,707 ----
pass
def p_except_dcl2(t):
! 'except_dcl : EXCEPT IDENT LBRACE member_list RBRACE'
pass
def p_op_dcl1(t):
! 'op_dcl : op_type_spec IDENT parameter_dcls'
pass
def p_op_dcl2(t):
! 'op_dcl : op_attribute op_type_spec IDENT parameter_dcls'
pass
def p_op_dcl3(t):
! 'op_dcl : op_type_spec IDENT parameter_dcls raises_expr'
pass
def p_op_dcl4(t):
! 'op_dcl : op_attribute op_type_spec IDENT parameter_dcls raises_expr'
pass
def p_op_dcl5(t):
! 'op_dcl : op_type_spec IDENT parameter_dcls context_expr'
pass
def p_op_dcl6(t):
! 'op_dcl : op_attribute op_type_spec IDENT parameter_dcls context_expr'
pass
def p_op_dcl7(t):
! 'op_dcl : op_type_spec IDENT parameter_dcls raises_expr context_expr'
pass
def p_op_dcl8(t):
! 'op_dcl : op_attribute op_type_spec IDENT parameter_dcls raises_expr
context_expr'
pass
def p_op_attribute(t):
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- gnue/appserver src/_featuretest/GodlParser.py s...,
Daniel E. Baumann <=