[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
gnue/appserver/src/_featuretest GodlParser.py O...
From: |
Daniel E. Baumann |
Subject: |
gnue/appserver/src/_featuretest GodlParser.py O... |
Date: |
Thu, 26 Dec 2002 20:24:59 -0500 |
CVSROOT: /cvsroot/gnue
Module name: gnue
Changes by: Daniel E. Baumann <address@hidden> 02/12/26 20:24:59
Modified files:
appserver/src/_featuretest: GodlParser.py Objects.py
thekitchensink.godl
Log message:
Finish GodlParser and write sample program, thekitchensink.godl now
parses and
the Gobject tree is printed.
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/appserver/src/_featuretest/GodlParser.py.diff?tr1=1.5&tr2=1.6&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/appserver/src/_featuretest/Objects.py.diff?tr1=1.6&tr2=1.7&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/appserver/src/_featuretest/thekitchensink.godl.diff?tr1=1.9&tr2=1.10&r1=text&r2=text
Patches:
Index: gnue/appserver/src/_featuretest/GodlParser.py
diff -c gnue/appserver/src/_featuretest/GodlParser.py:1.5
gnue/appserver/src/_featuretest/GodlParser.py:1.6
*** gnue/appserver/src/_featuretest/GodlParser.py:1.5 Thu Dec 26 00:37:30 2002
--- gnue/appserver/src/_featuretest/GodlParser.py Thu Dec 26 20:24:58 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.5 2002/12/26 05:37:30 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.6 2002/12/27 01:24:58 baumannd Exp $
import Objects
from gnue.common import GTypecast, GParser
***************
*** 41,55 ****
global xmlElements
if xmlElements == None:
!
! xmlElements =
! {
'odl_specification':
{
'BaseClass': Objects.GodlSpec,
'Required': 1,
'SingleInstance': 1,
! 'ParentTags': (None, , 'odl_definition', 'module',)
},
'odl_definition':
--- 41,53 ----
global xmlElements
if xmlElements == None:
! xmlElements = {
'odl_specification':
{
'BaseClass': Objects.GodlSpec,
'Required': 1,
'SingleInstance': 1,
! 'ParentTags': (None, 'odl_definition', 'module',),
},
'odl_definition':
***************
*** 57,63 ****
'BaseClass': Objects.GodlDefinition,
'Required': 1,
'SingleInstance' :1,
! 'ParentTags': ('odl_specification',)
},
'module':
--- 55,61 ----
'BaseClass': Objects.GodlDefinition,
'Required': 1,
'SingleInstance' :1,
! 'ParentTags': ('odl_specification',),
},
'module':
***************
*** 70,79 ****
{
'Required': 1,
'Unique': 1,
! 'Typecast': GTypecast.name
! }
},
! 'ParentTags': ('odl_definition',)
},
'typedef':
--- 68,77 ----
{
'Required': 1,
'Unique': 1,
! 'Typecast': GTypecast.name,
! },
},
! 'ParentTags': ('odl_definition',),
},
'typedef':
***************
*** 83,92 ****
{
'type':
{
! 'Typecast': GTypecast.text
! }
},
! 'ParentTags': ('odl_definition',)
},
'alias':
--- 81,90 ----
{
'type':
{
! 'Typecast': GTypecast.text,
! },
},
! 'ParentTags': ('odl_definition',),
},
'alias':
***************
*** 94,101 ****
'BaseClass': Objects.GodlAlias,
'Required': 1,
'Unique': 1,
! 'Typecast': GTypecast.name
! },
'struct':
{
--- 92,100 ----
'BaseClass': Objects.GodlAlias,
'Required': 1,
'Unique': 1,
! 'Typecast': GTypecast.name,
! 'ParentTags': ('typedef',),
! },
'struct':
{
***************
*** 106,113 ****
{
'Required': 1,
'Unique': 1,
! 'Typecast': GTypecast.name
! }
},
'ParentTags': ('odl_definition',)
},
--- 105,112 ----
{
'Required': 1,
'Unique': 1,
! 'Typecast': GTypecast.name,
! },
},
'ParentTags': ('odl_definition',)
},
***************
*** 116,135 ****
{
'BaseClass': Objects.GodlMembers,
'SingleInstance' : 1,
! 'ParentTags': ('struct', 'exception',)
},
'member':
{
! 'BaseCalss': Objects.GodlMember,
'Attributes':
{
'name':
{
'Required': 1,
'Unique': 1,
! 'Typecast': GTypecast.name
! }
},
'ParentTags': ('members',)
},
--- 115,134 ----
{
'BaseClass': Objects.GodlMembers,
'SingleInstance' : 1,
! 'ParentTags': ('struct', 'exception',),
},
'member':
{
! 'BaseClass': Objects.GodlMember,
'Attributes':
{
'name':
{
'Required': 1,
'Unique': 1,
! 'Typecast': GTypecast.name,
! },
},
'ParentTags': ('members',)
},
***************
*** 143,152 ****
{
'Required': 1,
'Unique': 1,
! 'Typecast': GTypecast.name
! }
},
! 'ParentTags': ('odl_definition',)
},
'switch':
--- 142,151 ----
{
'Required': 1,
'Unique': 1,
! 'Typecast': GTypecast.name,
! },
},
! 'ParentTags': ('odl_definition',),
},
'switch':
***************
*** 157,187 ****
'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':
--- 156,186 ----
'type':
{
'Required': 1,
! 'Typecast': GTypecast.text,
! },
},
'SingleInstance': 1,
! 'ParentTags': ('union',),
},
'case':
{
'BaseClass': Objects.GodlCase,
! 'Attributes':
{
'label':
{
'Required': 1,
! 'Typecast': GTypecast.text,
},
'name':
{
'Required': 1,
'Unique': 1,
! 'Typecast': GTypecast.name,
},
},
! 'ParentTags': ('switch',),
},
'default':
***************
*** 193,203 ****
{
'Required': 1,
'Unique': 1,
! 'Typecast': GTypecast.name
! }
},
'SingleInstance': 1,
! 'ParentTags': ('switch')
},
'enum':
--- 192,202 ----
{
'Required': 1,
'Unique': 1,
! 'Typecast': GTypecast.name,
! },
},
'SingleInstance': 1,
! 'ParentTags': ('switch'),
},
'enum':
***************
*** 209,224 ****
{
'Required': 1,
'Unique': 1,
! 'Typecast': GTypecast.name
! }
! }
! 'ParentTags': ('odl_definition',)
},
'element':
{
'BaseClass': Objects.GodlElement,
! 'ParentTags': ('enum',)
},
'const':
--- 208,223 ----
{
'Required': 1,
'Unique': 1,
! 'Typecast': GTypecast.name,
! },
! },
! 'ParentTags': ('odl_definition',),
},
'element':
{
'BaseClass': Objects.GodlElement,
! 'ParentTags': ('enum',),
},
'const':
***************
*** 228,242 ****
{
'name':
{
! 'Required': 1
'Unique': 1,
! 'Typecast': GTypecast.name
},
! 'type:'
{
'Required': 1,
! 'Typecast': GTypecast.text
! }
},
'ParentTags': ('odl_definition',)
},
--- 227,242 ----
{
'name':
{
! 'Required': 1,
'Unique': 1,
! 'Typecast': GTypecast.name,
},
!
! 'type':
{
'Required': 1,
! 'Typecast': GTypecast.text,
! },
},
'ParentTags': ('odl_definition',)
},
***************
*** 249,258 ****
'name':
{
'Required': 1,
! 'Unique': 1
! 'Typecast': GTypecast.name
},
! 'ParentTags': ('odl_definition', 'interface', 'class',)
},
'interface':
--- 249,259 ----
'name':
{
'Required': 1,
! 'Unique': 1,
! 'Typecast': GTypecast.name,
},
! },
! 'ParentTags': ('odl_definition', 'interface', 'class','raises',),
},
'interface':
***************
*** 263,283 ****
'name':
{
'Required': 1,
! 'Unique': 1
! 'Typecast': GTypecast.name
}
},
! 'ParentTags': ('odl_definition',)
},
'inherits':
{
! 'BaseClass': Objects.GodlInherits
'SingleInstance': 1,
! 'ParentTags': (interface, class,)
! }
-
'attribute':
{
'BaseClass': Objects.GodlAttribute,
--- 264,283 ----
'name':
{
'Required': 1,
! 'Unique': 1,
! 'Typecast': GTypecast.name,
}
},
! 'ParentTags': ('odl_definition',),
},
'inherits':
{
! 'BaseClass': Objects.GodlInherits,
'SingleInstance': 1,
! 'ParentTags': ('interface', 'class',),
! },
'attribute':
{
'BaseClass': Objects.GodlAttribute,
***************
*** 286,321 ****
'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
},
'oneway':
{
! 'Typecast': GTypecast.boolean
! }
},
!
'class':
{
'BaseClass': Objects.GodlClass,
--- 286,364 ----
'name':
{
'Required': 1,
! 'Unique': 1,
! 'Typecast': GTypecast.name,
},
'readonly':
{
! 'Typecast': GTypecast.boolean,
! },
},
! 'ParentTags': ('interface', 'class',),
},
'operation':
{
! 'BaseClass': Objects.GodlOperation,
'Attributes':
{
'name':
{
'Required': 1,
! 'Unique': 1,
! 'Typecast': GTypecast.name,
},
'oneway':
{
! 'Required': 0,
! 'Typecast': GTypecast.boolean,
! },
},
! },
!
! 'returns':
! {
! 'BaseClass': Objects.GodlReturns,
! 'Required': 0,
! 'ParentTags': ('operation',),
! },
!
! 'parameters':
! {
! 'BaseClass': Objects.GodlParameters,
! 'Required': 0,
! 'SingleInstance': 1,
! 'ParentTags': ('operation',),
! },
!
! 'parameter':
! {
! 'BaseClass': Objects.GodlParameter,
! 'Attributes':
! {
! 'name':
! {
! 'Required': 1,
! 'Unique': 1,
! 'Typecast': GTypecast.name,
! },
!
! 'mode':
! {
! 'Typecast': GTypecast.text,
! },
! },
! 'ParentTags': ('parameters',),
! },
!
! 'raises':
! {
! 'BaseClass': Objects.GodlRaises,
! 'ParentTags': ('operation',),
! },
!
'class':
{
'BaseClass': Objects.GodlClass,
***************
*** 324,346 ****
'name':
{
'Required': 1,
! 'Unique': 1
! 'Typecast': GTypecast.name
! }
},
! 'ParentTags': ('odl_definition',)
},
'extends':
{
'BaseClass': Objects.GodlExtends,
! 'ParentTags': ('class',)
},
'extent':
{
'BaseClass': Objects.GodlExtent,
! 'ParentTags': ('class',)
},
'relationship':
--- 367,389 ----
'name':
{
'Required': 1,
! 'Unique': 1,
! 'Typecast': GTypecast.name,
! },
},
! 'ParentTags': ('odl_definition',),
},
'extends':
{
'BaseClass': Objects.GodlExtends,
! 'ParentTags': ('class',),
},
'extent':
{
'BaseClass': Objects.GodlExtent,
! 'ParentTags': ('class',),
},
'relationship':
***************
*** 351,373 ****
'name':
{
'Required': 1,
! 'Unique': 1
! 'Typecast': GTypecast.name
! }
},
! 'ParentTags': ('class',)
},
'target':
{
'BaseClass': Objects.GodlTarget,
! 'ParentTags': ('relationship',)
},
'inverse':
{
'BaseClass': Objects.GodlInverse,
! 'ParentTags': ('relationship',)
},
'array':
--- 394,432 ----
'name':
{
'Required': 1,
! 'Unique': 1,
! 'Typecast': GTypecast.name,
! },
},
! 'ParentTags': ('class',),
},
'target':
{
'BaseClass': Objects.GodlTarget,
! 'ParentTags': ('relationship',),
},
'inverse':
{
'BaseClass': Objects.GodlInverse,
! 'ParentTags': ('relationship',),
! },
!
! 'string':
! {
! 'BaseClass': Objects.GodlString,
! 'Attributes':
! {
! 'size':
! {
! 'Typecast': GTypecast.whole,
! },
! },
! 'ParentTags': ('typedef', 'array', 'set', 'bag', 'list',
! 'sequence', 'key', 'value', 'member', 'case',
! 'default', 'target', 'returns', 'parameter',
! 'attribute',),
},
'array':
***************
*** 377,389 ****
{
'size':
{
! 'Typecast': GTypecast.integer
! }
},
'ParentTags': ('typedef', 'array', 'set', 'bag', 'list',
'sequence', 'key', 'value', 'member', 'case',
'default', 'target', 'returns', 'parameter',
! 'attribute',)
},
'sequence':
--- 436,448 ----
{
'size':
{
! 'Typecast': GTypecast.integer, # TODO: Should this be
GTypecast.whole?
! },
},
'ParentTags': ('typedef', 'array', 'set', 'bag', 'list',
'sequence', 'key', 'value', 'member', 'case',
'default', 'target', 'returns', 'parameter',
! 'attribute',),
},
'sequence':
***************
*** 392,398 ****
'ParentTags': ('typedef', 'array', 'set', 'bag', 'list',
'sequence', 'key', 'value', 'member', 'case',
'default', 'target', 'returns', 'parameter',
! 'attribute',)
},
'set':
--- 451,457 ----
'ParentTags': ('typedef', 'array', 'set', 'bag', 'list',
'sequence', 'key', 'value', 'member', 'case',
'default', 'target', 'returns', 'parameter',
! 'attribute',),
},
'set':
***************
*** 401,407 ****
'ParentTags': ('typedef', 'array', 'set', 'bag', 'list',
'sequence', 'key', 'value', 'member', 'case',
'default', 'target', 'returns', 'parameter',
! 'attribute',)
},
'bag':
--- 460,466 ----
'ParentTags': ('typedef', 'array', 'set', 'bag', 'list',
'sequence', 'key', 'value', 'member', 'case',
'default', 'target', 'returns', 'parameter',
! 'attribute',),
},
'bag':
***************
*** 410,425 ****
'ParentTags': ('typedef', 'array', 'set', 'bag', 'list',
'sequence', 'key', 'value', 'member', 'case',
'default', 'target', 'returns', 'parameter',
! 'attribute',)
},
! 'list'
{
'BaseClass': Objects.GodlList,
'ParentTags': ('typedef', 'array', 'set', 'bag', 'list',
'sequence', 'key', 'value', 'member', 'case',
'default', 'target', 'returns', 'parameter',
! 'attribute',)
},
'dictionary':
--- 469,484 ----
'ParentTags': ('typedef', 'array', 'set', 'bag', 'list',
'sequence', 'key', 'value', 'member', 'case',
'default', 'target', 'returns', 'parameter',
! 'attribute',),
},
! 'list':
{
'BaseClass': Objects.GodlList,
'ParentTags': ('typedef', 'array', 'set', 'bag', 'list',
'sequence', 'key', 'value', 'member', 'case',
'default', 'target', 'returns', 'parameter',
! 'attribute',),
},
'dictionary':
***************
*** 428,434 ****
'ParentTags': ('typedef', 'array', 'set', 'bag', 'list',
'sequence', 'key', 'value', 'member', 'case',
'default', 'target', 'returns', 'parameter',
! 'attribute',)
},
'key':
--- 487,493 ----
'ParentTags': ('typedef', 'array', 'set', 'bag', 'list',
'sequence', 'key', 'value', 'member', 'case',
'default', 'target', 'returns', 'parameter',
! 'attribute',),
},
'key':
***************
*** 436,442 ****
'BaseClass': Objects.GodlKey,
'Required': 1,
'SingleInstance': 1,
! 'ParentTags': ('dictionary',)
},
'value':
--- 495,501 ----
'BaseClass': Objects.GodlKey,
'Required': 1,
'SingleInstance': 1,
! 'ParentTags': ('dictionary',),
},
'value':
***************
*** 444,451 ****
'BaseClass': Objects.GodlValue,
'Required': 1,
'SingleInstance': 1,
! 'ParentTags': ('dictionary',)
! }
}
return xmlElements
--- 503,510 ----
'BaseClass': Objects.GodlValue,
'Required': 1,
'SingleInstance': 1,
! 'ParentTags': ('dictionary',),
! },
}
return xmlElements
***************
*** 464,466 ****
--- 523,534 ----
GParser.xmlHandler.__init__(self)
self.xmlElements = getXMLelements()
+
+ if __name__ == '__main__':
+ import sys
+ from gnue.common.FileUtils import openResource
+
+ fin = openResource(sys.argv[1])
+ objdefs = loadDefinition(fin, 0)
+ fin.close()
+ objdefs.showTree()
Index: gnue/appserver/src/_featuretest/Objects.py
diff -c gnue/appserver/src/_featuretest/Objects.py:1.6
gnue/appserver/src/_featuretest/Objects.py:1.7
*** gnue/appserver/src/_featuretest/Objects.py:1.6 Thu Dec 26 00:37:30 2002
--- gnue/appserver/src/_featuretest/Objects.py Thu Dec 26 20:24:58 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.6 2002/12/26 05:37:30 baumannd 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.7 2002/12/27 01:24:58 baumannd Exp $
from gnue.common.GObjects import GObj
from gnue.common.GRootObj import GRootObj
***************
*** 47,53 ****
class GodlAlias(GodlObject):
def __init__(self, parent):
! Godlbject.__init__(self, parent, type='GodlAlias')
class GodlStruct(GodlObject):
def __init__(self, parent):
--- 47,53 ----
class GodlAlias(GodlObject):
def __init__(self, parent):
! GodlObject.__init__(self, parent, type='GodlAlias')
class GodlStruct(GodlObject):
def __init__(self, parent):
***************
*** 95,101 ****
class GodlInherits(GodlObject):
def __init__(self, parent):
! Godl.__init__(self, parent, type='GodlInherits')
class GodlAttribute(GodlObject):
def __init__(self, parent):
--- 95,101 ----
class GodlInherits(GodlObject):
def __init__(self, parent):
! GodlObject.__init__(self, parent, type='GodlInherits')
class GodlAttribute(GodlObject):
def __init__(self, parent):
***************
*** 104,109 ****
--- 104,125 ----
class GodlOperation(GodlObject):
def __init__(self, parent):
GodlObject.__init__(self, parent, type='GodlOperation')
+
+ class GodlReturns(GodlObject):
+ def __init__(self, parent):
+ GodlObject.__init__(self, parent, type='GodlReturns')
+
+ class GodlParameters(GodlObject):
+ def __init__(self, parent):
+ GodlObject.__init__(self, parent, type='GodlParameters')
+
+ class GodlParameter(GodlObject):
+ def __init__(self, parent):
+ GodlObject.__init__(self, parent, type='GodlParameter')
+
+ class GodlRaises(GodlObject):
+ def __init__(self, parent):
+ GodlObject.__init__(self, parent, type='GodlRaises')
class GodlClass(GodlObject):
def __init__(self, parent):
***************
*** 128,133 ****
--- 144,153 ----
class GodlInverse(GodlObject):
def __init__(self, parent):
GodlObject.__init__(self, parent, type='GodlInverse')
+
+ class GodlString(GodlObject):
+ def __init__(self, parent):
+ GodlObject.__init__(self, parent, type='GodlString')
class GodlArray(GodlObject):
def __init__(self, parent):
Index: gnue/appserver/src/_featuretest/thekitchensink.godl
diff -c gnue/appserver/src/_featuretest/thekitchensink.godl:1.9
gnue/appserver/src/_featuretest/thekitchensink.godl:1.10
*** gnue/appserver/src/_featuretest/thekitchensink.godl:1.9 Thu Dec 19
00:58:05 2002
--- gnue/appserver/src/_featuretest/thekitchensink.godl Thu Dec 26 20:24:58 2002
***************
*** 40,46 ****
<member name="barname">string</member>
<member name="barprice">float"</member>
<member name="barz">short</member>
! <member name="fubar"/>unsigned long</member>
<member name="fbar">unsigned short</member>
<member name="bars">long long</member>
</members>
--- 40,46 ----
<member name="barname">string</member>
<member name="barprice">float"</member>
<member name="barz">short</member>
! <member name="fubar">unsigned long</member>
<member name="fbar">unsigned short</member>
<member name="bars">long long</member>
</members>
***************
*** 168,177 ****
</typedef>
<typedef type="octet">
! <alias>Octet</declarator>
</typedef>
! <typedef type="date"
<alias>Date</alias>
</typedef>
--- 168,177 ----
</typedef>
<typedef type="octet">
! <alias>Octet</alias>
</typedef>
! <typedef type="date">
<alias>Date</alias>
</typedef>
***************
*** 183,189 ****
<alias>Interval</alias>
</typedef>
! <typedef type="timestamp>
<alias>Timestamp</alias>
</typedef>
--- 183,189 ----
<alias>Interval</alias>
</typedef>
! <typedef type="timestamp">
<alias>Timestamp</alias>
</typedef>
***************
*** 608,614 ****
</members>
</struct>
! <typedef type="PizaType"
<alias>pizza_t</alias>
</typedef>
--- 608,614 ----
</members>
</struct>
! <typedef type="PizaType">
<alias>pizza_t</alias>
</typedef>