xquery/trunk/XQuery__AstNode.st
changeset 0 5057afe1ec87
child 18 3476eed46de5
equal deleted inserted replaced
-1:000000000000 0:5057afe1ec87
       
     1 "{ Package: 'stx:goodies/xmlsuite/xquery' }"
       
     2 
       
     3 "{ NameSpace: XQuery }"
       
     4 
       
     5 Perseus::ASTNode subclass:#AstNode
       
     6 	instanceVariableNames:''
       
     7 	classVariableNames:''
       
     8 	poolDictionaries:''
       
     9 	category:'XQuery-AST'
       
    10 !
       
    11 
       
    12 
       
    13 !AstNode methodsFor:'accessing'!
       
    14 
       
    15 nodeTypeName
       
    16 
       
    17     ^self class nameWithoutNameSpacePrefix copyFrom: 4
       
    18 
       
    19     "Created: / 31-10-2007 / 12:30:48 / janfrog"
       
    20 ! !
       
    21 
       
    22 !AstNode methodsFor:'checks'!
       
    23 
       
    24 assert: aBlockOrBoolean description: aString
       
    25 
       
    26     aBlockOrBoolean value ifFalse:
       
    27         [XQueryInterpreterError raiseErrorString:'err:XUST - ', aString]
       
    28 
       
    29     "Created: / 21-11-2007 / 15:30:59 / janfrog"
       
    30 !
       
    31 
       
    32 ensureIsNotUpdatingExpression
       
    33 
       
    34 self assert: (self isUpdatingExpression not) description:'must be an updating expression here'
       
    35 
       
    36     "Modified: / 05-12-2007 / 10:16:50 / janfrog"
       
    37 !
       
    38 
       
    39 ensureIsUpdatingExpression
       
    40 
       
    41 self assert: (self isUpdatingExpression) description:'cannot be an updating expression here'
       
    42 
       
    43     "Created: / 21-11-2007 / 16:51:34 / janfrog"
       
    44 ! !
       
    45 
       
    46 !AstNode methodsFor:'converting'!
       
    47 
       
    48 asCollectionOfForClauses
       
    49     |s|
       
    50 
       
    51     s := (OrderedCollection new:2) writeStream.
       
    52     self forClausesOn:s.
       
    53     ^ s contents
       
    54 
       
    55     "Created: / 28-03-2007 / 19:32:57 / janfrog"
       
    56 !
       
    57 
       
    58 asCollectionOfForLetClauses
       
    59     |s|
       
    60 
       
    61     s := (OrderedCollection new:2) writeStream.
       
    62     self forLetClausesOn:s.
       
    63     ^ s contents
       
    64 
       
    65     "Created: / 28-03-2007 / 17:58:42 / janfrog"
       
    66 !
       
    67 
       
    68 asCollectionOfLetClauses
       
    69     |s|
       
    70 
       
    71     s := (OrderedCollection new:2) writeStream.
       
    72     self letClausesOn:s.
       
    73     ^ s contents
       
    74 
       
    75     "Created: / 28-03-2007 / 19:33:42 / janfrog"
       
    76 !
       
    77 
       
    78 asCollectionOfQuantifiedExprImpls
       
    79     |s|
       
    80 
       
    81     s := (OrderedCollection new:2) writeStream.
       
    82     self quantifiedExprImplsOn:s.
       
    83     ^ s contents
       
    84 
       
    85     "Created: / 28-03-2007 / 22:01:31 / janfrog"
       
    86 !
       
    87 
       
    88 asDummyValue
       
    89 
       
    90     ^AstDummyNode new
       
    91         dummyValue: self
       
    92 
       
    93     "Created: / 28-03-2007 / 20:26:24 / janfrog"
       
    94 ! !
       
    95 
       
    96 !AstNode methodsFor:'private'!
       
    97 
       
    98 forClausesOn:aStream 
       
    99     "nothing to do here"
       
   100 
       
   101     "Created: / 28-03-2007 / 19:33:15 / janfrog"
       
   102 !
       
   103 
       
   104 forLetClausesOn:aStream 
       
   105     "nothing to do here"
       
   106 
       
   107     "Created: / 28-03-2007 / 17:58:16 / janfrog"
       
   108 !
       
   109 
       
   110 letClausesOn:aStream 
       
   111     "nothing to do here"
       
   112 
       
   113     "Created: / 28-03-2007 / 19:33:48 / janfrog"
       
   114 !
       
   115 
       
   116 quantifiedExprImplsOn:s
       
   117 
       
   118     "Created: / 28-03-2007 / 22:01:56 / janfrog"
       
   119 ! !
       
   120 
       
   121 !AstNode methodsFor:'testing'!
       
   122 
       
   123 isAstAbbrevForwardStep
       
   124     ^ false
       
   125 
       
   126     "Modified: / 12-10-2006 / 21:57:46 / ked"
       
   127 !
       
   128 
       
   129 isAstAdditiveExpr
       
   130     ^ false
       
   131 
       
   132     "Modified: / 12-10-2006 / 21:57:47 / ked"
       
   133 !
       
   134 
       
   135 isAstAndExpr
       
   136     ^ false
       
   137 
       
   138     "Modified: / 12-10-2006 / 21:57:46 / ked"
       
   139 !
       
   140 
       
   141 isAstAnyKindTest
       
   142     ^ false
       
   143 
       
   144     "Created: / 21-11-2006 / 21:54:04 / ked"
       
   145 !
       
   146 
       
   147 isAstAttribNameOrWildcard
       
   148     ^ false
       
   149 
       
   150     "Created: / 21-11-2006 / 21:58:21 / ked"
       
   151 !
       
   152 
       
   153 isAstAttributeTest
       
   154     ^ false
       
   155 
       
   156     "Created: / 21-11-2006 / 21:57:19 / ked"
       
   157 !
       
   158 
       
   159 isAstAxisStep
       
   160     ^ false
       
   161 
       
   162     "Modified: / 12-10-2006 / 21:57:48 / ked"
       
   163 !
       
   164 
       
   165 isAstCompAttrConstructor
       
   166     ^ false
       
   167 
       
   168     "Modified: / 12-10-2006 / 21:57:46 / ked"
       
   169 !
       
   170 
       
   171 isAstCompDocConstructor
       
   172     ^ false
       
   173 
       
   174     "Modified: / 12-10-2006 / 21:57:47 / ked"
       
   175 !
       
   176 
       
   177 isAstCompElemConstructor
       
   178     ^ false
       
   179 
       
   180     "Modified: / 12-10-2006 / 21:57:45 / ked"
       
   181 !
       
   182 
       
   183 isAstCompTextConstructor
       
   184     ^ false
       
   185 
       
   186     "Modified: / 12-10-2006 / 21:57:46 / ked"
       
   187 !
       
   188 
       
   189 isAstComparisonExpr
       
   190     ^ false
       
   191 
       
   192     "Modified: / 12-10-2006 / 21:57:48 / ked"
       
   193 !
       
   194 
       
   195 isAstContextItemExpr
       
   196     ^ false
       
   197 
       
   198     "Created: / 07-11-2006 / 22:03:56 / ked"
       
   199 !
       
   200 
       
   201 isAstDecimalLiteral
       
   202     ^ false
       
   203 
       
   204     "Modified: / 12-10-2006 / 21:57:45 / ked"
       
   205 !
       
   206 
       
   207 isAstDirAttributeList
       
   208     ^ false
       
   209 
       
   210     "Modified: / 12-10-2006 / 21:57:46 / ked"
       
   211 !
       
   212 
       
   213 isAstDirElemConstructor
       
   214     ^ false
       
   215 
       
   216     "Modified: / 12-10-2006 / 21:57:45 / ked"
       
   217 !
       
   218 
       
   219 isAstDirElemContent
       
   220     ^ false
       
   221 
       
   222     "Modified: / 12-10-2006 / 21:57:46 / ked"
       
   223 !
       
   224 
       
   225 isAstDocumentTest
       
   226     ^ false
       
   227 
       
   228     "Created: / 21-11-2006 / 21:55:13 / ked"
       
   229 !
       
   230 
       
   231 isAstDoubleLiteral
       
   232     ^ false
       
   233 
       
   234     "Modified: / 12-10-2006 / 21:57:46 / ked"
       
   235 !
       
   236 
       
   237 isAstElementNameOrWildcard
       
   238     ^ false
       
   239 
       
   240     "Created: / 21-11-2006 / 22:00:25 / ked"
       
   241 !
       
   242 
       
   243 isAstElementTest
       
   244     ^ false
       
   245 
       
   246     "Created: / 21-11-2006 / 21:59:24 / ked"
       
   247 !
       
   248 
       
   249 isAstEnclosedExpr
       
   250     ^ false
       
   251 
       
   252     "Created: / 06-11-2006 / 22:41:13 / ked"
       
   253 !
       
   254 
       
   255 isAstExpr
       
   256     ^ false
       
   257 
       
   258     "Modified: / 12-10-2006 / 21:57:46 / ked"
       
   259 !
       
   260 
       
   261 isAstFLWORExpr
       
   262     ^ false
       
   263 
       
   264     "Modified: / 12-10-2006 / 21:57:47 / ked"
       
   265 !
       
   266 
       
   267 isAstFLWORExpr_ForLet
       
   268     ^ false
       
   269 
       
   270     "Modified: / 12-10-2006 / 21:57:45 / ked"
       
   271 !
       
   272 
       
   273 isAstFilterExpr
       
   274     ^ false
       
   275 
       
   276     "Modified: / 12-10-2006 / 21:57:47 / ked"
       
   277 !
       
   278 
       
   279 isAstForClause
       
   280     ^ false
       
   281 
       
   282     "Modified: / 12-10-2006 / 21:57:46 / ked"
       
   283 !
       
   284 
       
   285 isAstForwardStep
       
   286     ^ false
       
   287 
       
   288     "Modified: / 12-10-2006 / 21:57:46 / ked"
       
   289 !
       
   290 
       
   291 isAstFunctionCall
       
   292     ^ false
       
   293 
       
   294     "Modified: / 12-10-2006 / 21:57:46 / ked"
       
   295 !
       
   296 
       
   297 isAstFunctionParametersList
       
   298     ^ false
       
   299 
       
   300     "Created: / 11-11-2006 / 18:51:39 / ked"
       
   301 !
       
   302 
       
   303 isAstIfExpr
       
   304     ^ false
       
   305 
       
   306     "Modified: / 12-10-2006 / 21:57:48 / ked"
       
   307 !
       
   308 
       
   309 isAstIntegerLiteral
       
   310     ^ false
       
   311 
       
   312     "Modified: / 12-10-2006 / 21:57:47 / ked"
       
   313 !
       
   314 
       
   315 isAstIntersectExceptExpr
       
   316     ^ false
       
   317 
       
   318     "Modified: / 12-10-2006 / 21:57:45 / ked"
       
   319 !
       
   320 
       
   321 isAstLetClause
       
   322     ^ false
       
   323 
       
   324     "Modified: / 12-10-2006 / 21:57:45 / ked"
       
   325 !
       
   326 
       
   327 isAstMultiplicativeExpr
       
   328     ^ false
       
   329 
       
   330     "Modified: / 12-10-2006 / 21:57:45 / ked"
       
   331 !
       
   332 
       
   333 isAstNCName
       
   334     ^ false
       
   335 
       
   336     "Modified: / 12-10-2006 / 21:57:46 / ked"
       
   337 !
       
   338 
       
   339 isAstNameTest
       
   340     ^ false
       
   341 
       
   342     "Created: / 12-10-2006 / 21:57:47 / ked"
       
   343 !
       
   344 
       
   345 isAstOrExpr
       
   346     ^ false
       
   347 
       
   348     "Modified: / 12-10-2006 / 21:57:46 / ked"
       
   349 !
       
   350 
       
   351 isAstOrderByClause
       
   352     ^ false
       
   353 
       
   354     "Modified: / 12-10-2006 / 21:57:47 / ked"
       
   355 !
       
   356 
       
   357 isAstOrderModifier
       
   358     ^ false
       
   359 
       
   360     "Modified: / 12-10-2006 / 21:57:45 / ked"
       
   361 !
       
   362 
       
   363 isAstOrderSpec
       
   364     ^ false
       
   365 
       
   366     "Modified: / 12-10-2006 / 21:57:47 / ked"
       
   367 !
       
   368 
       
   369 isAstOrderSpecList
       
   370     ^ false
       
   371 
       
   372     "Modified: / 12-10-2006 / 21:57:46 / ked"
       
   373 !
       
   374 
       
   375 isAstParenthesizedExpr
       
   376     ^ false
       
   377 
       
   378     "Modified: / 12-10-2006 / 21:57:45 / ked"
       
   379 !
       
   380 
       
   381 isAstPathExpr
       
   382     ^ false
       
   383 
       
   384     "Modified: / 12-10-2006 / 21:57:47 / ked"
       
   385 !
       
   386 
       
   387 isAstPredefinedEntityRef
       
   388     ^ false
       
   389 
       
   390     "Modified: / 12-10-2006 / 21:57:47 / ked"
       
   391 !
       
   392 
       
   393 isAstPredicate
       
   394     ^ false
       
   395 
       
   396     "Modified: / 12-10-2006 / 21:57:46 / ked"
       
   397 !
       
   398 
       
   399 isAstPredicateList
       
   400     ^ false
       
   401 
       
   402     "Modified: / 12-10-2006 / 21:57:47 / ked"
       
   403 !
       
   404 
       
   405 isAstQName
       
   406     ^ false
       
   407 
       
   408     "Modified: / 12-10-2006 / 21:57:46 / ked"
       
   409 !
       
   410 
       
   411 isAstQuantifiedExpr
       
   412     ^ false
       
   413 
       
   414     "Modified: / 12-10-2006 / 21:57:47 / ked"
       
   415 !
       
   416 
       
   417 isAstQuantifiedExpr_Impl
       
   418     ^ false
       
   419 
       
   420     "Modified: / 12-10-2006 / 21:57:47 / ked"
       
   421 !
       
   422 
       
   423 isAstRangeExpr
       
   424     ^ false
       
   425 
       
   426     "Modified: / 12-10-2006 / 21:57:47 / ked"
       
   427 !
       
   428 
       
   429 isAstRelativePathExpr
       
   430     ^ false
       
   431 
       
   432     "Modified: / 12-10-2006 / 21:57:45 / ked"
       
   433 !
       
   434 
       
   435 isAstReverseStep
       
   436     ^ false
       
   437 
       
   438     "Modified: / 12-10-2006 / 21:57:47 / ked"
       
   439 !
       
   440 
       
   441 isAstStringLiteral
       
   442     ^ false
       
   443 
       
   444     "Modified: / 12-10-2006 / 21:57:47 / ked"
       
   445 !
       
   446 
       
   447 isAstTextTest
       
   448     ^ false
       
   449 
       
   450     "Created: / 21-11-2006 / 21:56:13 / ked"
       
   451 !
       
   452 
       
   453 isAstUnaryExpr
       
   454     ^ false
       
   455 
       
   456     "Modified: / 12-10-2006 / 21:57:45 / ked"
       
   457 !
       
   458 
       
   459 isAstUnionExpr
       
   460     ^ false
       
   461 
       
   462     "Modified: / 12-10-2006 / 21:57:45 / ked"
       
   463 !
       
   464 
       
   465 isAstVarRef
       
   466     ^ false
       
   467 
       
   468     "Modified: / 12-10-2006 / 21:57:47 / ked"
       
   469 !
       
   470 
       
   471 isAstWhereClause
       
   472     ^ false
       
   473 
       
   474     "Modified: / 12-10-2006 / 21:57:46 / ked"
       
   475 !
       
   476 
       
   477 isAstWildcard
       
   478     ^ false
       
   479 
       
   480     "Modified: / 12-10-2006 / 21:57:46 / ked"
       
   481 !
       
   482 
       
   483 isUpdatingExpression
       
   484 
       
   485   "
       
   486     self children do:
       
   487         [:childNode| childNode ensureIsNotUpdatingExpression ].
       
   488    "
       
   489 
       
   490     self children do:
       
   491         [:childNode|childNode isUpdatingExpression ifTrue:[^true]].
       
   492 
       
   493 
       
   494 
       
   495     ^ false.
       
   496 
       
   497     "Created: / 21-11-2007 / 14:17:06 / janfrog"
       
   498     "Modified: / 21-11-2007 / 15:59:29 / janfrog"
       
   499 ! !
       
   500 
       
   501 !AstNode methodsFor:'ui support'!
       
   502 
       
   503 children
       
   504 
       
   505     ^self childrenDictionary values
       
   506 
       
   507     "Created: / 27-03-2007 / 15:32:05 / janfrog"
       
   508     "Modified: / 12-04-2007 / 11:33:48 / janfrog"
       
   509 ! !
       
   510 
       
   511 !AstNode methodsFor:'visiting'!
       
   512 
       
   513 acceptVisitor:aVisitor 
       
   514     self subclassResponsibility
       
   515 
       
   516     "Created: / 06-07-2006 / 19:12:11 / ked"
       
   517 ! !
       
   518 
       
   519 !AstNode class methodsFor:'documentation'!
       
   520 
       
   521 version
       
   522     ^ '$Header: /opt/data/cvs/stx/goodies/xmlsuite/xquery/XQuery__AstNode.st,v 1.8 2007-12-05 21:12:21 vranyj1 Exp $'
       
   523 ! !