PageRenderTime 37ms CodeModel.GetById 9ms RepoModel.GetById 1ms app.codeStats 1ms

/ecl/hql/hqlgram.y

https://github.com/emuharemagic/HPCC-Platform
Happy | 10874 lines | 10241 code | 633 blank | 0 comment | 0 complexity | 6b411853aeb8dcaf51238ca55dab6420 MD5 | raw file

Large files files are truncated, but you can click here to view the full file

  1. //
  2. // HPCC SYSTEMS software Copyright (C) 2012 HPCC Systems.
  3. //
  4. // Licensed under the Apache License, Version 2.0 (the "License");
  5. // you may not use this file except in compliance with the License.
  6. // You may obtain a copy of the License at
  7. //
  8. // http://www.apache.org/licenses/LICENSE-2.0
  9. //
  10. // Unless required by applicable law or agreed to in writing, software
  11. // distributed under the License is distributed on an "AS IS" BASIS,
  12. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. // See the License for the specific language governing permissions and
  14. // limitations under the License.
  15. //############################################################################## */
  16. //Either api.pure of c++ skeleton could be used, not both (which causes an error).
  17. //Note the c++ generation still generates a separate class for the raw processing from the HqlGram class, so whichever is
  18. //used the productions need to use parser->... to access the context
  19. %define api.pure
  20. //%error-verbose
  21. %lex-param {HqlGram* parser}
  22. %lex-param {int * yyssp}
  23. %parse-param {HqlGram* parser}
  24. %name-prefix "eclyy"
  25. //
  26. %destructor {$$.release();} <>
  27. //Could override destructors for all tokens e.g.,
  28. //%destructor {} ABS
  29. //but warnings still come out, and improvement in code is marginal.
  30. //Only defining destructors for those productions that need them would solve it, but be open to missing items.
  31. //Adding a comment to reference unused parameters also fails to solve it because it ignores references in comments (and a bit ugly)
  32. //fixing bison to ignore destructor {} for need use is another alternative - but would take a long time to feed into a public build.
  33. %{
  34. #include "platform.h"
  35. #include <stdio.h>
  36. #include <stdlib.h>
  37. #include "hql.hpp"
  38. #include "jlib.hpp"
  39. #include "jmisc.hpp"
  40. #include "jexcept.hpp"
  41. #include "hqlerrors.hpp"
  42. #include "hqlgram.hpp"
  43. #include "hqlfold.hpp"
  44. #include "hqlpmap.hpp"
  45. #include "hqlutil.hpp"
  46. #include "hqlattr.hpp"
  47. #include "hqlmeta.hpp"
  48. #define REDEF_MSG(name) StringBuffer msg; \
  49. msg.append(w"Identifier '"); \
  50. msg.append(name.queryExpr()->queryName()->str()); \
  51. msg.append("' before := "); \
  52. msg.append(" is already defined"); \
  53. parser->reportError(ERR_ID_REDEFINE, name, msg.str())
  54. #define REDEF_ERROR(name) \
  55. { \
  56. REDEF_MSG(name); \
  57. }
  58. #define REDEF_ERROR1(name,e1) \
  59. { \
  60. REDEF_MSG(name); \
  61. e1.release(); \
  62. }
  63. #define REDEF_ERROR2(name,e1,e2) \
  64. { \
  65. REDEF_MSG(name); \
  66. e1.release(); \
  67. e2.release(); \
  68. }
  69. #define REDEF_ERROR3(name,e1,e2,e3) \
  70. { \
  71. REDEF_MSG(name); \
  72. e1.release(); \
  73. e2.release(); \
  74. e3.release(); \
  75. }
  76. inline int eclyylex(attribute * yylval, HqlGram* parser, const short int * yyssp)
  77. {
  78. return parser->yyLex(yylval, yyssp);
  79. }
  80. static void eclsyntaxerror(HqlGram * parser, const char * s, short yystate, int token);
  81. #define eclyyerror(parser, s) eclsyntaxerror(parser, s, yystate, yychar)
  82. #define ignoreBisonWarning(x)
  83. #define ignoreBisonWarnings2(x,y)
  84. #define ignoreBisonWarnings3(x,y,z)
  85. %}
  86. //=========================================== tokens ====================================
  87. %token
  88. /* remember to add any new tokens to the error reporter and lexer too! */
  89. /* If they clash with other #defines etc then use TOK_ as a prefix */
  90. ABS
  91. ACOS
  92. AFTER
  93. AGGREGATE
  94. ALIAS
  95. ALL
  96. ALLNODES
  97. AND
  98. ANY
  99. APPLY
  100. _ARRAY_
  101. AS
  102. ASCII
  103. ASIN
  104. TOK_ASSERT
  105. ASSTRING
  106. ATAN
  107. ATAN2
  108. ATMOST
  109. AVE
  110. BACKUP
  111. BEFORE
  112. BEST
  113. BETWEEN
  114. TOK_BITMAP
  115. BIG
  116. BLOB
  117. BNOT
  118. BUILD
  119. CARDINALITY
  120. CASE
  121. TOK_CATCH
  122. CHECKPOINT
  123. CHOOSE
  124. CHOOSEN
  125. CHOOSENALL
  126. CHOOSESETS
  127. CLUSTER
  128. CLUSTERSIZE
  129. COGROUP
  130. __COMMON__
  131. __COMPOUND__
  132. COMBINE
  133. COMPRESSED
  134. __COMPRESSED__
  135. TOK_CONST
  136. CORRELATION
  137. COS
  138. COSH
  139. COUNT
  140. COUNTER
  141. COVARIANCE
  142. CPPBODY
  143. CRC
  144. CRON
  145. CSV
  146. DATASET
  147. __DEBUG__
  148. DEDUP
  149. DEFAULT
  150. DEFINE
  151. DENORMALIZE
  152. DEPRECATED
  153. DESC
  154. DICTIONARY
  155. DISTRIBUTE
  156. DISTRIBUTED
  157. DISTRIBUTION
  158. DYNAMIC
  159. EBCDIC
  160. ECLCRC
  161. ELSE
  162. ELSEIF
  163. EMBED
  164. EMBEDDED
  165. _EMPTY_
  166. ENCODING
  167. ENCRYPT
  168. ENCRYPTED
  169. END
  170. ENDCPP
  171. ENDEMBED
  172. ENTH
  173. ENUM
  174. TOK_ERROR
  175. ESCAPE
  176. EVALUATE
  177. EVENT
  178. EVENTEXTRA
  179. EVENTNAME
  180. EXCEPT
  181. EXCLUSIVE
  182. EXISTS
  183. EXP
  184. EXPIRE
  185. EXPORT
  186. EXTEND
  187. FAIL
  188. FAILCODE
  189. FAILMESSAGE
  190. FAILURE
  191. TOK_FALSE
  192. FEATURE
  193. FETCH
  194. FEW
  195. FILEPOSITION
  196. FILTERED
  197. FIRST
  198. TOK_FIXED
  199. FLAT
  200. FROM
  201. FORMAT_ATTR
  202. FORWARD
  203. FROMUNICODE
  204. FROMXML
  205. FULL
  206. FUNCTION
  207. GETENV
  208. GLOBAL
  209. GRAPH
  210. GROUP
  211. GROUPBY
  212. GROUPED
  213. __GROUPED__
  214. GUARD
  215. HASH
  216. HASH32
  217. HASH64
  218. HASHMD5
  219. HAVING
  220. HEADING
  221. HINT
  222. HOLE
  223. HTTPCALL
  224. HTTPHEADER
  225. IF
  226. IFF
  227. IFBLOCK
  228. TOK_IGNORE
  229. IMPLEMENTS
  230. IMPORT
  231. INDEPENDENT
  232. INLINE
  233. TOK_IN
  234. INNER
  235. INTERFACE
  236. INTERNAL
  237. INTFORMAT
  238. ISNULL
  239. ISVALID
  240. ITERATE
  241. JOIN
  242. JOINED
  243. KEEP
  244. KEYDIFF
  245. KEYED
  246. KEYPATCH
  247. KEYUNICODE
  248. LABELED
  249. LAST
  250. LEFT
  251. LENGTH
  252. LIBRARY
  253. LIMIT
  254. LINKCOUNTED
  255. LITERAL
  256. LITTLE
  257. LN
  258. LOADXML
  259. LOCAL
  260. LOCALE
  261. LOCALFILEPOSITION
  262. TOK_LOG
  263. LOGICALFILENAME
  264. LOOKUP
  265. LOOP
  266. LZW
  267. MANY
  268. MAP
  269. MATCHED
  270. MATCHLENGTH
  271. MATCHPOSITION
  272. MATCHROW
  273. MATCHTEXT
  274. MATCHUNICODE
  275. MATCHUTF8
  276. MAX
  277. MAXCOUNT
  278. MAXLENGTH
  279. MAXSIZE
  280. MERGE
  281. MERGE_ATTR
  282. MERGEJOIN
  283. MIN
  284. MODULE
  285. MOFN
  286. MULTIPLE
  287. NAMED
  288. NAMEOF
  289. NAMESPACE
  290. NOBOUNDCHECK
  291. NOCASE
  292. NOFOLD
  293. NOHOIST
  294. NOLOCAL
  295. NONEMPTY
  296. NOOVERWRITE
  297. NORMALIZE
  298. NOROOT
  299. NOSCAN
  300. NOSORT
  301. __NOSTREAMING__
  302. NOT
  303. NOTHOR
  304. NOTIFY
  305. NOTRIM
  306. NOXPATH
  307. OF
  308. OMITTED
  309. ONCE
  310. ONFAIL
  311. ONLY
  312. ONWARNING
  313. OPT
  314. OR
  315. ORDERED
  316. OUTER
  317. OUTPUT
  318. TOK_OUT
  319. OVERWRITE
  320. __OWNED__
  321. PACKED
  322. PARALLEL
  323. PARSE
  324. PARTITION
  325. PARTITION_ATTR
  326. TOK_PATTERN
  327. PENALTY
  328. PERSIST
  329. PHYSICALFILENAME
  330. PIPE
  331. __PLATFORM__
  332. POWER
  333. PREFETCH
  334. PRELOAD
  335. PRIORITY
  336. PRIVATE
  337. PROCESS
  338. PROJECT
  339. PROXYADDRESS
  340. PULL
  341. PULLED
  342. QUOTE
  343. RANDOM
  344. RANGE
  345. RANK
  346. RANKED
  347. REALFORMAT
  348. RECORD
  349. RECORDOF
  350. RECOVERY
  351. REGEXFIND
  352. REGEXREPLACE
  353. REGROUP
  354. REJECTED
  355. RELATIONSHIP
  356. REMOTE
  357. REPEAT
  358. RESPONSE
  359. RETRY
  360. RETURN
  361. RIGHT
  362. RIGHT_NN
  363. ROLLUP
  364. ROUND
  365. ROUNDUP
  366. ROW
  367. ROWS
  368. ROWSET
  369. ROWDIFF
  370. RULE
  371. SAMPLE
  372. SCAN
  373. SECTION
  374. SELF
  375. SEPARATOR
  376. __SEQUENCE__
  377. SEQUENTIAL
  378. SERVICE
  379. SET
  380. SHARED
  381. SIMPLE_TYPE
  382. SIN
  383. SINGLE
  384. SINH
  385. SIZEOF
  386. SKEW
  387. SKIP
  388. SMART
  389. SOAPACTION
  390. SOAPCALL
  391. SORT
  392. SORTED
  393. SQL
  394. SQRT
  395. STABLE
  396. __STAND_ALONE__
  397. STEPPED
  398. STORED
  399. STREAMED
  400. SUBSORT
  401. SUCCESS
  402. SUM
  403. SWAPPED
  404. TABLE
  405. TAN
  406. TANH
  407. TERMINATOR
  408. THEN
  409. THISNODE
  410. THOR
  411. THRESHOLD
  412. TIMEOUT
  413. TIMELIMIT
  414. TOKEN
  415. TOPN
  416. TOUNICODE
  417. TOXML
  418. TRANSFER
  419. TRANSFORM
  420. TRIM
  421. TRUNCATE
  422. TOK_TRUE
  423. TYPE
  424. TYPEOF
  425. UNICODEORDER
  426. UNGROUP
  427. UNORDERED
  428. UNSIGNED
  429. UNSORTED
  430. UNSTABLE
  431. UPDATE
  432. USE
  433. VALIDATE
  434. VARIANCE
  435. VIRTUAL
  436. WAIT
  437. TOK_WARNING
  438. WHEN
  439. WHICH
  440. WIDTH
  441. WILD
  442. WITHIN
  443. WHOLE
  444. WORKUNIT
  445. XML_TOKEN
  446. XMLDECODE
  447. XMLDEFAULT
  448. XMLENCODE
  449. XMLPROJECT
  450. XMLTEXT
  451. XMLUNICODE
  452. XPATH
  453. //Operators
  454. FIELD_REF
  455. FIELDS_REF
  456. ANDAND
  457. EQ
  458. NE
  459. LE
  460. LT
  461. GE
  462. GT
  463. ORDER
  464. ASSIGN
  465. GOESTO
  466. DOTDOT
  467. DIV
  468. SHIFTL
  469. SHIFTR
  470. DATAROW_ID
  471. DATASET_ID
  472. DICTIONARY_ID
  473. SCOPE_ID
  474. VALUE_ID
  475. VALUE_ID_REF
  476. ACTION_ID
  477. UNKNOWN_ID
  478. RECORD_ID
  479. ALIEN_ID
  480. TRANSFORM_ID
  481. PATTERN_ID
  482. FEATURE_ID
  483. EVENT_ID
  484. ENUM_ID
  485. LIST_DATASET_ID
  486. SORTLIST_ID
  487. TYPE_ID
  488. SET_TYPE_ID
  489. PATTERN_TYPE_ID
  490. DATASET_TYPE_ID
  491. DICTIONARY_TYPE_ID
  492. DATAROW_FUNCTION
  493. DATASET_FUNCTION
  494. DICTIONARY_FUNCTION
  495. VALUE_FUNCTION
  496. ACTION_FUNCTION
  497. PATTERN_FUNCTION
  498. RECORD_FUNCTION
  499. EVENT_FUNCTION
  500. SCOPE_FUNCTION
  501. TRANSFORM_FUNCTION
  502. LIST_DATASET_FUNCTION
  503. VALUE_MACRO
  504. DEFINITIONS_MACRO
  505. BOOL_CONST
  506. INTEGER_CONST
  507. STRING_CONST
  508. DATA_CONST
  509. REAL_CONST
  510. UNICODE_CONST
  511. TYPE_LPAREN
  512. TYPE_RPAREN
  513. MACRO
  514. COMPLEX_MACRO
  515. ENDMACRO
  516. SKIPPED
  517. HASHEND
  518. HASHELIF
  519. HASHBREAK
  520. INDEX
  521. HASH_CONSTANT
  522. HASH_OPTION
  523. HASH_WORKUNIT
  524. HASH_STORED
  525. HASH_LINK
  526. HASH_ONWARNING
  527. INTERNAL_READ_NEXT_TOKEN
  528. // __INTERNAL__HASHDEFINED_FOUND
  529. // __INTERNAL__HASHDEFINED_NOTFOUND
  530. /* add new token before this! */
  531. YY_LAST_TOKEN
  532. %left LOWEST_PRECEDENCE
  533. %left VALUE_MACRO
  534. %left OR
  535. %left AND
  536. %left reduceAttrib
  537. %left ORDER UNICODEORDER
  538. %left SHIFTL SHIFTR
  539. %left '+' '-'
  540. %left '*' '/' '%' DIV
  541. %left '|' '^'
  542. %left '&' ANDAND
  543. %left NOT
  544. %left '.'
  545. %left '('
  546. %left '['
  547. %left HIGHEST_PRECEDENCE
  548. %%
  549. //================================== begin of syntax section ==========================
  550. hqlQuery
  551. : ENCRYPTED hqlQueryBody { ignoreBisonWarnings3($$,$1,$2); }
  552. | hqlQueryBody
  553. ;
  554. hqlQueryBody
  555. : definitions
  556. | query
  557. { parser->addResult($1.getExpr(), $1); $$.clear(); }
  558. | definitions query
  559. {
  560. ignoreBisonWarning($1);
  561. parser->addResult($2.getExpr(), $2); $$.clear();
  562. }
  563. | RETURN goodObject ';'
  564. { parser->addResult($2.getExpr(), $2); $$.clear(); }
  565. | definitions setActiveToExpected RETURN goodObject ';'
  566. { parser->addResult($4.getExpr(), $4); $$.clear(); }
  567. | compoundModule ';'
  568. { parser->addResult($1.getExpr(), $1); $$.clear(); }
  569. //Temporary productions...
  570. | recordDef ';'
  571. {
  572. ignoreBisonWarning($2);
  573. parser->addResult($1.getExpr(), $1); $$.clear();
  574. }
  575. | definitions recordDef ';'
  576. {
  577. ignoreBisonWarnings2($1, $3);
  578. parser->addResult($2.getExpr(), $2); $$.clear();
  579. }
  580. |
  581. //Special production used processing template queries
  582. | GOESTO goodObject ';'
  583. { parser->addResult($2.getExpr(), $2); $$.clear(); }
  584. ;
  585. setActiveToExpected
  586. : { parser->setCurrentToExpected(); $$.clear(); }
  587. ;
  588. importSection
  589. : startIMPORT importItem endIMPORT
  590. { parser->lastpos = $3.pos.position+1; $$.clear(); }
  591. | startIMPORT error endIMPORT
  592. { parser->lastpos = $3.pos.position+1; $$.clear(); }
  593. ;
  594. startIMPORT
  595. : IMPORT { parser->setIdUnknown(true); $$.clear(); }
  596. ;
  597. endIMPORT
  598. : ';' { parser->setIdUnknown(false); $$.clear(); }
  599. ;
  600. importItem
  601. : importSelectorList
  602. {
  603. parser->processImport($1, NULL);
  604. $$.clear();
  605. }
  606. | importSelectorList FROM importSelector
  607. {
  608. parser->processImport($1, $3, NULL);
  609. $$.clear();
  610. }
  611. | importSelectorList AS UNKNOWN_ID
  612. {
  613. parser->processImport($1, $3.getId());
  614. $$.clear();
  615. }
  616. | importSelectorList FROM importSelector AS UNKNOWN_ID
  617. {
  618. parser->processImport($1, $3, $5.getId());
  619. $$.clear();
  620. }
  621. | '*' FROM importSelector
  622. {
  623. parser->processImportAll($3);
  624. $$.clear();
  625. }
  626. | importSelectorList AS '*'
  627. {
  628. if (queryLegacyImportSemantics())
  629. parser->reportWarning(ERR_DEPRECATED, $1.pos, "IMPORT <module> AS * is deprecated, use IMPORT * FROM <module>");
  630. else
  631. parser->reportError(ERR_DEPRECATED, $1.pos, "IMPORT <module> AS * is deprecated, use IMPORT * FROM <module>");
  632. parser->processImportAll($1);
  633. $$.clear();
  634. }
  635. ;
  636. importSelectorList
  637. : beginList importItems
  638. {
  639. HqlExprArray importItems;
  640. parser->endList(importItems);
  641. $$.setExpr(createComma(importItems), $2);
  642. }
  643. ;
  644. importItems
  645. : importSelector
  646. {
  647. parser->addListElement($1.getExpr());
  648. $$.clear();
  649. }
  650. | importItems ',' importSelector
  651. {
  652. parser->addListElement($3.getExpr());
  653. $$.clear();
  654. }
  655. ;
  656. importSelector
  657. : importId;
  658. importId
  659. : UNKNOWN_ID {
  660. $$.setExpr(createId($1.getId()), $1);
  661. }
  662. | '$' {
  663. $$.setExpr(createAttribute(selfAtom), $1);
  664. }
  665. | importId '.' UNKNOWN_ID
  666. {
  667. $$.setExpr(createAttribute(_dot_Atom, $1.getExpr(), createId($3.getId())), $1);
  668. }
  669. | importId '.' '^'
  670. {
  671. $$.setExpr(createAttribute(_container_Atom, $1.getExpr()), $1);
  672. }
  673. ;
  674. defineType
  675. : typeDef
  676. | setType
  677. | explicitDatasetType
  678. | explicitDictionaryType
  679. | ROW {
  680. IHqlExpression* record = queryNullRecord();
  681. $$.setType(makeRowType(record->getType()));
  682. $$.setPosition($1);
  683. }
  684. | transformType
  685. ;
  686. explicitDatasetType
  687. : explicitDatasetType1
  688. | GROUPED explicitDatasetType1
  689. {
  690. $$.setType(makeGroupedTableType($2.getType()));
  691. $$.setPosition($1);
  692. }
  693. ;
  694. explicitDatasetType1
  695. : DATASET
  696. {
  697. $$.setType(makeTableType(makeRowType(queryNullRecord()->getType())));
  698. $$.setPosition($1);
  699. }
  700. | DATASET '(' recordDef childDatasetOptions ')'
  701. {
  702. OwnedHqlExpr record = $3.getExpr();
  703. OwnedHqlExpr options = $4.getExpr();
  704. ITypeInfo * recordType = createRecordType(record);
  705. Owned<ITypeInfo> tableType = makeTableType(makeRowType(recordType));
  706. if (options)
  707. tableType.setown(makeAttributeModifier(LINK(tableType), createAttribute(_childAttr_Atom, LINK(options))));
  708. $$.setType(tableType.getClear());
  709. $$.setPosition($1);
  710. }
  711. | _ARRAY_ explicitDatasetType
  712. {
  713. $$.setType(makeOutOfLineModifier($2.getType()));
  714. $$.setPosition($1);
  715. }
  716. | LINKCOUNTED explicitDatasetType
  717. {
  718. Owned<ITypeInfo> dsType = $2.getType();
  719. $$.setType(setLinkCountedAttr(dsType, true));
  720. $$.setPosition($1);
  721. }
  722. | STREAMED explicitDatasetType
  723. {
  724. Owned<ITypeInfo> dsType = $2.getType();
  725. Owned<ITypeInfo> linkedType = setLinkCountedAttr(dsType, true);
  726. $$.setType(setStreamedAttr(linkedType, true));
  727. $$.setPosition($1);
  728. }
  729. | EMBEDDED explicitDatasetType
  730. {
  731. $$.setType(makeAttributeModifier($2.getType(), getEmbeddedAttr()));
  732. $$.setPosition($1);
  733. }
  734. | userTypedefDataset
  735. ;
  736. explicitDictionaryType
  737. : DICTIONARY
  738. {
  739. $$.setType(makeDictionaryType(makeRowType(queryNullRecord()->getType())));
  740. $$.setPosition($1);
  741. }
  742. | DICTIONARY '(' recordDef ')'
  743. {
  744. OwnedHqlExpr record = $3.getExpr();
  745. ITypeInfo * recordType = createRecordType(record);
  746. $$.setType(makeDictionaryType(makeRowType(recordType)));
  747. $$.setPosition($1);
  748. }
  749. | LINKCOUNTED explicitDictionaryType
  750. {
  751. Owned<ITypeInfo> dsType = $2.getType();
  752. $$.setType(setLinkCountedAttr(dsType, true));
  753. $$.setPosition($1);
  754. }
  755. | userTypedefDictionary
  756. ;
  757. explicitRowType
  758. : explicitRowType1
  759. | LINKCOUNTED explicitRowType1
  760. {
  761. Owned<ITypeInfo> rowType = $2.getType();
  762. $$.setType(setLinkCountedAttr(rowType, true));
  763. $$.setPosition($1);
  764. }
  765. ;
  766. explicitRowType1
  767. : ROW {
  768. IHqlExpression* record = queryNullRecord();
  769. $$.setType(makeRowType(record->getType()));
  770. $$.setPosition($1);
  771. }
  772. | ROW '(' recordDef ')'
  773. {
  774. OwnedHqlExpr record = $3.getExpr();
  775. $$.setType(makeRowType(record->getType()));
  776. $$.setPosition($1);
  777. }
  778. ;
  779. transformType
  780. : TRANSFORM '(' recordDef ')'
  781. {
  782. OwnedHqlExpr record = $3.getExpr();
  783. $$.setType(makeTransformType(LINK(record->queryRecordType())), $1);
  784. }
  785. | TRANSFORM '(' dataSet ')'
  786. {
  787. OwnedHqlExpr ds = $3.getExpr();
  788. $$.setType(makeTransformType(LINK(ds->queryRecordType())), $1);
  789. }
  790. ;
  791. propType
  792. : simpleType /* only simple type is supported for service */
  793. | scopeFlag simpleType
  794. {
  795. parser->reportError(ERR_SVC_NOSCOPEMODIFIER,$1,"Function in service can not specify EXPORT or SHARED");
  796. $$.setType($2.getType());
  797. }
  798. | scopeFlag {
  799. parser->reportError(ERR_SVC_NOSCOPEMODIFIER,$1,"Function in service can not specify EXPORT or SHARED");
  800. $$.setType(makeVoidType());
  801. }
  802. ;
  803. paramType
  804. : typeDef
  805. {
  806. OwnedITypeInfo type = $1.getType();
  807. //Syntactic oddity. A record means a row of that record type.
  808. if (type->getTypeCode() == type_record)
  809. type.setown(makeRowType(type.getClear()));
  810. $$.setType(type.getClear());
  811. $$.setPosition($1);
  812. }
  813. | DATASET_ID {
  814. OwnedHqlExpr dataset = $1.getExpr();
  815. // $$.setType(makeOriginalModifier(createRecordType(dataset), LINK(dataset)));
  816. $$.setType(makeRowType(createRecordType(dataset)));
  817. $$.setPosition($1);
  818. }
  819. | moduleScopeDot DATASET_ID leaveScope
  820. {
  821. //slightly nasty to add two original modifiers to the record, but the first one allows
  822. //us to get the record right, and the second the types of parameters on transforms.
  823. $1.release();
  824. OwnedHqlExpr dataset = $2.getExpr();
  825. //$$.setType(makeOriginalModifier(createRecordType(dataset), LINK(dataset)));
  826. $$.setType(makeRowType(createRecordType(dataset)));
  827. $$.setPosition($2);
  828. }
  829. | abstractDataset {
  830. OwnedHqlExpr record = $1.getExpr();
  831. OwnedHqlExpr abstractRecord = createAbstractRecord(record);
  832. OwnedITypeInfo type = makeTableType(makeRowType(abstractRecord->getType()));
  833. $$.setType(type.getClear(), $1);
  834. parser->setTemplateAttribute();
  835. }
  836. | explicitDatasetType
  837. | explicitDictionaryType
  838. | explicitRowType
  839. | abstractModule
  840. {
  841. OwnedHqlExpr scope = $1.getExpr();
  842. $$.setType(scope->getType()); // more what about if moduleScope is a parameter?
  843. $$.setPosition($1);
  844. }
  845. | patternParamType
  846. | VIRTUAL RECORD
  847. {
  848. IHqlExpression* record = queryNullRecord();
  849. OwnedHqlExpr abstractRecord = createAbstractRecord(record);
  850. $$.setType(abstractRecord->getType(), $1);
  851. parser->setTemplateAttribute();
  852. }
  853. ;
  854. patternParamType
  855. : TOK_PATTERN {
  856. $$.setType(makePatternType());
  857. $$.setPosition($1);
  858. }
  859. | RULE {
  860. $$.setType(makeRuleType(NULL));
  861. $$.setPosition($1);
  862. }
  863. | TOKEN {
  864. $$.setType(makeTokenType());
  865. $$.setPosition($1);
  866. }
  867. ;
  868. object
  869. : goodObject
  870. | badObject
  871. ;
  872. goodObject
  873. : dataSet
  874. | dictionary
  875. | expression
  876. {
  877. //Remove later to allow sortlist attributes
  878. parser->normalizeExpression($1);
  879. $$.inherit($1);
  880. }
  881. | dataRow
  882. | recordDef
  883. | service
  884. | action
  885. | transformDef
  886. | transform
  887. | complexType
  888. | macro
  889. | embedBody
  890. | eventObject
  891. | compoundAttribute
  892. | abstractModule
  893. | goodTypeObject optFieldAttrs
  894. {
  895. Owned<ITypeInfo> type = $1.getType();
  896. HqlExprArray attrs;
  897. $2.unwindCommaList(attrs);
  898. $$.setExpr(createValue(no_typedef, type.getClear(), attrs), $1);
  899. }
  900. | enumDef
  901. | enumTypeId
  902. | setOfDatasets
  903. | anyFunction
  904. | fieldSelectedFromRecord
  905. {
  906. OwnedHqlExpr value = $1.getExpr();
  907. $$.setExpr(createValue(no_indirect, value->getType(), LINK(value)), $1);
  908. }
  909. | __SEQUENCE__
  910. {
  911. //NB: Undocumented experimental feature
  912. //This is only allowed as an object, rather than a sequence so we can correctly check whether the containing
  913. //attribute (if any) is parametered, and add the implicit parameter there
  914. $$.setExpr(parser->createScopedSequenceExpr(), $1);
  915. }
  916. | DEFINE goodObject
  917. {
  918. //Ugly internal unsupported syntax for defining an out of line function
  919. //Needs a lot more work.
  920. OwnedHqlExpr value = $2.getExpr();
  921. $$.setExpr(parser->convertToOutOfLineFunction($2.pos, value), $1);
  922. }
  923. ;
  924. goodTypeObject
  925. : setType
  926. | simpleType
  927. | alienTypeInstance
  928. | userTypedefType
  929. | RULE TYPE '(' recordDef ')'
  930. {
  931. OwnedHqlExpr record = $4.getExpr();
  932. $$.setType(makeRuleType(record->getType()));
  933. $$.setPosition($1);
  934. }
  935. | explicitDatasetType
  936. | explicitDictionaryType
  937. ;
  938. badObject
  939. : error {
  940. parser->processError(false);
  941. $$.setExpr(createConstant((__int64) 0), $1);
  942. }
  943. ;
  944. macro
  945. : MACRO {
  946. Owned<IFileContents> contents = $1.getContents();
  947. IHqlExpression* expr = createUnknown(no_macro, makeBoolType(), macroAtom, LINK(contents));
  948. #if defined(TRACE_MACRO)
  949. PrintLog("MACRO>> verify: macro definition at %d:%d\n",yylval.startLine, yylval.startColumn);
  950. #endif
  951. //Use a named symbol to associate a line number/column
  952. expr = createSymbol(macroId, NULL, expr, NULL,
  953. false, false, (object_type)0,
  954. NULL,
  955. yylval.pos.lineno, yylval.pos.column, 0, 0, 0);
  956. $$.setExpr(expr, $1);
  957. }
  958. | COMPLEX_MACRO {
  959. Owned<IFileContents> contents = $1.getContents();
  960. IHqlExpression* expr = createUnknown(no_macro, makeVoidType(), macroAtom, LINK(contents));
  961. #if defined(TRACE_MACRO)
  962. PrintLog("MACRO>> verify: macro definition at %d:%d\n",yylval.startLine, yylval.startColumn);
  963. #endif
  964. //Use a named symbol to associate a line number/column
  965. expr = createSymbol(macroId, NULL, expr, NULL,
  966. false, false, (object_type)0,
  967. NULL,
  968. yylval.pos.lineno, yylval.pos.column, 0, 0, 0);
  969. $$.setExpr(expr, $1);
  970. }
  971. ;
  972. embedBody
  973. : CPPBODY {
  974. OwnedHqlExpr embeddedCppText = $1.getExpr();
  975. $$.setExpr(parser->processEmbedBody($1, embeddedCppText, NULL, NULL), $1);
  976. }
  977. | embedPrefix CPPBODY
  978. {
  979. OwnedHqlExpr language = $1.getExpr();
  980. OwnedHqlExpr embedText = $2.getExpr();
  981. if (language->getOperator()==no_comma)
  982. $$.setExpr(parser->processEmbedBody($2, embedText, language->queryChild(0), language->queryChild(1)), $1);
  983. else
  984. $$.setExpr(parser->processEmbedBody($2, embedText, language, NULL), $1);
  985. }
  986. | EMBED '(' abstractModule ',' expression ')'
  987. {
  988. parser->normalizeExpression($5, type_stringorunicode, true);
  989. OwnedHqlExpr language = $3.getExpr();
  990. OwnedHqlExpr embedText = $5.getExpr();
  991. $$.setExpr(parser->processEmbedBody($5, embedText, language, NULL), $1);
  992. }
  993. | IMPORT '(' abstractModule ',' expression attribs ')'
  994. {
  995. parser->normalizeExpression($5, type_stringorunicode, true);
  996. OwnedHqlExpr language = $3.getExpr();
  997. OwnedHqlExpr funcname = $5.getExpr();
  998. OwnedHqlExpr attribs = createComma(createAttribute(importAtom), $6.getExpr());
  999. $$.setExpr(parser->processEmbedBody($6, funcname, language, attribs), $1);
  1000. }
  1001. ;
  1002. embedPrefix
  1003. : EMBED '(' abstractModule attribs ')'
  1004. {
  1005. parser->getLexer()->enterEmbeddedMode();
  1006. $$.setExpr(createComma($3.getExpr(), $4.getExpr()), $1);
  1007. }
  1008. ;
  1009. compoundAttribute
  1010. : startCompoundAttribute optDefinitions returnAction ';' END
  1011. {
  1012. $$.setExpr(parser->processCompoundFunction($3, false), $3);
  1013. }
  1014. ;
  1015. startCompoundAttribute
  1016. : FUNCTION
  1017. {
  1018. parser->enterScope(false);
  1019. parser->enterCompoundObject();
  1020. $$.clear();
  1021. }
  1022. ;
  1023. returnAction
  1024. : RETURN goodObject
  1025. {
  1026. $$.setExpr($2.getExpr(), $2);
  1027. }
  1028. ;
  1029. compoundModule
  1030. : startCompoundModule moduleBase moduleDefinitions END
  1031. {
  1032. $$.setExpr(parser->processModuleDefinition($1), $1);
  1033. }
  1034. | PROJECT '(' abstractModule ',' abstractModule scopeProjectOpts ')'
  1035. {
  1036. OwnedHqlExpr flags = $6.getExpr();
  1037. IHqlExpression *expr = parser->implementInterfaceFromModule($3, $5, flags);
  1038. $$.setExpr(expr, $1);
  1039. }
  1040. ;
  1041. startCompoundModule
  1042. : MODULE
  1043. {
  1044. parser->enterVirtualScope();
  1045. parser->enterCompoundObject();
  1046. $$.setPosition($1);
  1047. }
  1048. | INTERFACE
  1049. {
  1050. parser->enterVirtualScope();
  1051. parser->enterCompoundObject();
  1052. OwnedHqlExpr attr = createAttribute(interfaceAtom);
  1053. parser->appendToActiveScope(attr);
  1054. $$.setPosition($1);
  1055. }
  1056. ;
  1057. moduleDefinitions
  1058. :
  1059. | moduleDefinitions moduleDefinition
  1060. ;
  1061. moduleBase
  1062. : '(' abstractModuleList ')' moduleOptions
  1063. | moduleOptions
  1064. ;
  1065. moduleOptions
  1066. : %prec LOWEST_PRECEDENCE // Ensure that '(' gets shifted instead of causing a s/r error
  1067. | moduleOptions ',' moduleOption
  1068. {
  1069. OwnedHqlExpr expr = $3.getExpr();
  1070. if (expr)
  1071. parser->appendToActiveScope(expr);
  1072. $$.clear();
  1073. $$.setPosition($3);
  1074. }
  1075. ;
  1076. moduleOption
  1077. : __NOSTREAMING__
  1078. {
  1079. //Only for internal testing...
  1080. $$.setExpr(createAttribute(_noStreaming_Atom), $1);
  1081. }
  1082. | INTERFACE
  1083. {
  1084. $$.setExpr(createAttribute(interfaceAtom), $1);
  1085. }
  1086. | VIRTUAL
  1087. {
  1088. $$.setExpr(createAttribute(virtualAtom), $1);
  1089. }
  1090. | FORWARD
  1091. {
  1092. parser->processForwardModuleDefinition($1);
  1093. $$.setExpr(NULL, $1);
  1094. }
  1095. | LIBRARY '(' scopeFunction ')'
  1096. {
  1097. $$.setExpr(createExprAttribute(libraryAtom, $3.getExpr()), $1);
  1098. }
  1099. ;
  1100. abstractModuleList
  1101. : abstractModuleItem
  1102. | abstractModuleList ',' abstractModuleItem
  1103. ;
  1104. abstractModuleItem
  1105. : abstractModule
  1106. {
  1107. OwnedHqlExpr expr = $1.getExpr();
  1108. if (parser->checkValidBaseModule($1, expr))
  1109. parser->appendToActiveScope(expr);
  1110. $$.clear();
  1111. $$.setPosition($1);
  1112. }
  1113. ;
  1114. //MORE: If complex type could be defined in a non assignment context then TYPE will need to become hard reserved.
  1115. complexType
  1116. : startTYPE definitions END
  1117. {
  1118. $$.setExpr(parser->processAlienType($3),$1);
  1119. }
  1120. | startTYPE END {
  1121. parser->reportError(ERR_USRTYPE_EMPTYDEF,$1,"Empty user TYPE definition");
  1122. $$.setExpr(parser->processAlienType($2),$1);
  1123. }
  1124. ;
  1125. startTYPE
  1126. : TYPE {
  1127. parser->beginAlienType($1);
  1128. $$.clear();
  1129. $$.setPosition($1);
  1130. }
  1131. ;
  1132. defineid
  1133. : UNKNOWN_ID {
  1134. parser->beginDefineId($1.getId(), NULL);
  1135. $$.setType(NULL);
  1136. $$.setPosition($1);
  1137. }
  1138. | SCOPE_ID {
  1139. parser->beginDefineId(parser->getNameFromExpr($1), NULL);
  1140. $$.setType(NULL);
  1141. $$.setPosition($1);
  1142. }
  1143. | recordDef {
  1144. parser->beginDefineId(parser->getNameFromExpr($1), NULL);
  1145. $$.setType(NULL);
  1146. $$.setPosition($1);
  1147. }
  1148. | TRANSFORM_ID {
  1149. parser->beginDefineId(parser->getNameFromExpr($1), NULL);
  1150. $$.setType(NULL);
  1151. $$.setPosition($1);
  1152. }
  1153. | TYPE_ID {
  1154. parser->beginDefineId(parser->getNameFromExpr($1), NULL);
  1155. $$.setType(NULL);
  1156. $$.setPosition($1);
  1157. }
  1158. | defineType knownOrUnknownId
  1159. {
  1160. Owned<ITypeInfo> type = $1.getType();
  1161. if (type->getTypeCode() == type_alien)
  1162. type.set(type->queryPromotedType());
  1163. parser->beginDefineId($2.getId(), type);
  1164. $$.setType(type.getClear());
  1165. $$.setPosition($1);
  1166. }
  1167. | globalScopedDatasetId knownOrUnknownId
  1168. {
  1169. OwnedHqlExpr ds = $1.getExpr();
  1170. parser->beginDefineId($2.getId(), ds->queryType());
  1171. $$.setType(ds->getType());
  1172. $$.setPosition($1);
  1173. }
  1174. | UNKNOWN_ID UNKNOWN_ID
  1175. {
  1176. parser->reportError(ERR_UNKNOWN_TYPE, $1, "Unknown type '%s'", $1.getId()->str());
  1177. parser->beginDefineId($2.getId(), NULL);
  1178. $$.setType(NULL);
  1179. $$.setPosition($1);
  1180. }
  1181. ;
  1182. knownOrUnknownId
  1183. : UNKNOWN_ID
  1184. | knownId { $$.setId(parser->getNameFromExpr($1)); $$.setPosition($1); }
  1185. | knownFunction1 { $$.setId(parser->getNameFromExpr($1)); $$.setPosition($1); }
  1186. ;
  1187. knownId
  1188. : DATAROW_ID
  1189. | DATASET_ID
  1190. | DICTIONARY_ID
  1191. | VALUE_ID
  1192. | ACTION_ID
  1193. | RECORD_ID
  1194. | ALIEN_ID
  1195. | TYPE_ID
  1196. | TRANSFORM_ID
  1197. | FEATURE_ID
  1198. | SCOPE_ID
  1199. | PATTERN_ID
  1200. | LIST_DATASET_ID
  1201. ;
  1202. knownFunction1
  1203. : DATAROW_FUNCTION
  1204. | DATASET_FUNCTION
  1205. | DICTIONARY_FUNCTION
  1206. | VALUE_FUNCTION
  1207. | ACTION_FUNCTION
  1208. | PATTERN_FUNCTION
  1209. | EVENT_FUNCTION
  1210. | TRANSFORM_FUNCTION
  1211. | LIST_DATASET_FUNCTION
  1212. // Following cause s/r problems
  1213. // | RECORD_FUNCTION
  1214. // | SCOPE_FUNCTION
  1215. ;
  1216. scopeFlag
  1217. : EXPORT { $$.setInt(EXPORT_FLAG); $$.setPosition($1); }
  1218. | SHARED { $$.setInt(SHARED_FLAG); $$.setPosition($1); }
  1219. | LOCAL { $$.setInt(0); $$.setPosition($1); }
  1220. | EXPORT VIRTUAL { $$.setInt(EXPORT_FLAG|VIRTUAL_FLAG); $$.setPosition($1); }
  1221. | SHARED VIRTUAL { $$.setInt(SHARED_FLAG|VIRTUAL_FLAG); $$.setPosition($1); }
  1222. ;
  1223. // scopeflags needs to be explicitly included, rather than using an optScopeFlags production, otherwise you get shift reduce errors - since it is the first item on a line.
  1224. defineidWithOptScope
  1225. : defineid {
  1226. $$.setDefineId(parser->createDefineId(0, $1.getType()));
  1227. $$.setPosition($1);
  1228. }
  1229. | scopeFlag defineid
  1230. {
  1231. $$.setDefineId(parser->createDefineId((int)$1.getInt(), $2.getType()));
  1232. $$.setPosition($1);
  1233. }
  1234. ;
  1235. definePatternIdWithOptScope
  1236. : definePatternId {
  1237. $$.setDefineId(parser->createDefineId(0, $1.getType()));
  1238. $$.setPosition($1);
  1239. }
  1240. | scopeFlag definePatternId
  1241. {
  1242. $$.setDefineId(parser->createDefineId((int)$1.getInt(), $2.getType()));
  1243. $$.setPosition($1);
  1244. }
  1245. ;
  1246. definePatternId
  1247. : TOK_PATTERN knownOrUnknownId
  1248. {
  1249. ITypeInfo *type = makePatternType();
  1250. parser->beginDefineId($2.getId(), type);
  1251. $$.setType(type);
  1252. $$.setPosition($1);
  1253. }
  1254. | RULE knownOrUnknownId
  1255. {
  1256. ITypeInfo *type = makeRuleType(NULL);
  1257. parser->beginDefineId($2.getId(), type);
  1258. $$.setType(type);
  1259. $$.setPosition($1);
  1260. }
  1261. | RULE '(' recordDef ')' knownOrUnknownId
  1262. {
  1263. OwnedHqlExpr record = $3.getExpr();
  1264. ITypeInfo *type = makeRuleType(record->getType());
  1265. parser->beginDefineId($5.getId(), type);
  1266. $$.setType(type);
  1267. $$.setPosition($1);
  1268. }
  1269. | TOKEN knownOrUnknownId
  1270. {
  1271. ITypeInfo *type = makeTokenType();
  1272. parser->beginDefineId($2.getId(), type);
  1273. $$.setType(type);
  1274. $$.setPosition($1);
  1275. }
  1276. | userTypedefPattern knownOrUnknownId
  1277. {
  1278. ITypeInfo *type = $1.getType();
  1279. parser->beginDefineId($2.getId(), type);
  1280. $$.setType(type);
  1281. $$.setPosition($1);
  1282. }
  1283. ;
  1284. optDefinitions
  1285. :
  1286. | optDefinitions definition
  1287. ;
  1288. definitions
  1289. : definition
  1290. | definitions definition
  1291. ;
  1292. attributeDefinition
  1293. : DEFINITIONS_MACRO definition
  1294. | moduleScopeDot DEFINITIONS_MACRO leaveScope definition
  1295. {
  1296. $1.release();
  1297. $$.clear();
  1298. }
  1299. | defineidWithOptScope parmdef ASSIGN object optfailure ';'
  1300. {
  1301. if ($5.queryExpr())
  1302. parser->normalizeExpression($4);
  1303. $$.clear($1);
  1304. parser->defineSymbolProduction($1, $2, $3, &$4, &$5, $6);
  1305. }
  1306. | definePatternIdWithOptScope parmdef featureParameters ASSIGN pattern optfailure ';'
  1307. {
  1308. parser->definePatternSymbolProduction($1, $4, $5, $6, $7);
  1309. $$.clear();
  1310. }
  1311. | defineFeatureIdWithOptScope ';'
  1312. {
  1313. DefineIdSt* defineid = $1.getDefineId();
  1314. IHqlExpression *expr = createValue(no_null, makeFeatureType());
  1315. expr = createValue(no_pat_featuredef, expr->getType(), expr);
  1316. parser->doDefineSymbol(defineid, expr, NULL, $1, $2.pos.position, $2.pos.position, false);
  1317. $$.clear();
  1318. }
  1319. | defineFeatureIdWithOptScope ASSIGN featureDefine ';'
  1320. {
  1321. DefineIdSt* defineid = $1.getDefineId();
  1322. IHqlExpression *expr = $3.getExpr();
  1323. expr = createValue(no_pat_featuredef, expr->getType(), expr);
  1324. parser->doDefineSymbol(defineid, expr, NULL, $1, $2.pos.position, $4.pos.position, false);
  1325. $$.clear();
  1326. }
  1327. ;
  1328. definition
  1329. : simpleDefinition
  1330. | ';' {
  1331. //Extra ';' are ignored, partly to reduce problems with trailing ';' inside macros
  1332. $$.clear();
  1333. }
  1334. ;
  1335. simpleDefinition
  1336. : attributeDefinition
  1337. | query ';' {
  1338. parser->addResult($1.getExpr(), $1);
  1339. $$.clear();
  1340. }
  1341. /* general error */
  1342. | error ';' {
  1343. yyerrok;
  1344. parser->processError(true);
  1345. $$.clear();
  1346. }
  1347. | importSection
  1348. | metaCommandWithNoSemicolon simpleDefinition
  1349. ;
  1350. metaCommandWithNoSemicolon
  1351. : setMetaCommand
  1352. {
  1353. //These are really treated like actions now, this is here for backward compatibility
  1354. parser->reportWarning(ERR_DEPRECATED, $1.pos, "#command with no trailing semicolon is deprecated");
  1355. parser->addResult($1.getExpr(), $1);
  1356. $$.clear();
  1357. }
  1358. ;
  1359. moduleDefinition
  1360. : defineidWithOptScope parmdef ';'
  1361. {
  1362. parser->defineSymbolProduction($1, $2, $3, NULL, NULL, $3);
  1363. $$.clear();
  1364. $$.setPosition($1);
  1365. }
  1366. | definition
  1367. ;
  1368. setMetaCommand
  1369. : HASH_OPTION '(' expression ',' expression ')'
  1370. {
  1371. parser->normalizeExpression($3, type_string, true);
  1372. parser->normalizeExpression($5, type_any, true);
  1373. $$.setExpr(createValue(no_setmeta, makeVoidType(), createAttribute(debugAtom), $3.getExpr(), $5.getExpr()), $1);
  1374. }
  1375. | HASH_WORKUNIT '(' expression ',' expression ')'
  1376. {
  1377. parser->normalizeExpression($3, type_string, true);
  1378. parser->normalizeExpression($5, type_any, true);
  1379. $$.setExpr(createValue(no_setmeta, makeVoidType(), createAttribute(workunitAtom), $3.getExpr(), $5.getExpr()), $1);
  1380. }
  1381. | HASH_STORED '(' expression ',' hashStoredValue ')'
  1382. {
  1383. parser->normalizeStoredNameExpression($3);
  1384. $$.setExpr(createValue(no_setmeta, makeVoidType(), createAttribute(storedAtom), $3.getExpr(), $5.getExpr()), $1);
  1385. }
  1386. | HASH_CONSTANT '(' expression ',' hashStoredValue ')'
  1387. {
  1388. parser->normalizeStoredNameExpression($3);
  1389. $$.setExpr(createValue(no_setmeta, makeVoidType(), createAttribute(constAtom), $3.getExpr(), $5.getExpr()), $1);
  1390. }
  1391. | HASH_LINK '(' expression ')'
  1392. {
  1393. parser->normalizeExpression($3, type_string, true);
  1394. $$.setExpr(createValue(no_setmeta, makeVoidType(), createAttribute(linkAtom), $3.getExpr()), $1);
  1395. }
  1396. | HASH_ONWARNING '(' expression ',' warningAction ')'
  1397. {
  1398. parser->normalizeExpression($3, type_int, false);
  1399. $$.setExpr(createValue(no_setmeta, makeVoidType(), createAttribute(onWarningAtom), $3.getExpr(), $5.getExpr()), $1);
  1400. }
  1401. ;
  1402. hashStoredValue
  1403. : expression
  1404. {
  1405. parser->normalizeExpression($1, type_any, false);
  1406. $$.inherit($1);
  1407. }
  1408. | dataSet
  1409. | dataRow
  1410. ;
  1411. optfailure
  1412. : ':' failclause
  1413. {
  1414. $$.setExpr($2.getExpr(), $1);
  1415. }
  1416. | { $$.setNullExpr(); $$.clearPosition(); }
  1417. ;
  1418. failclause
  1419. : failure
  1420. | failclause ',' failure
  1421. {
  1422. IHqlExpression * previousWorkflow = $1.getExpr();
  1423. IHqlExpression * newWorkflow = $3.getExpr();
  1424. parser->checkWorkflowMultiples(previousWorkflow, newWorkflow, $3);
  1425. $$.setExpr(createComma(previousWorkflow, newWorkflow), $1);
  1426. }
  1427. ;
  1428. failure
  1429. : FAILURE '(' action ')'
  1430. {
  1431. $$.setExpr(createValue(no_failure, $3.getExpr(), NULL), $1);
  1432. }
  1433. | SUCCESS '(' action ')'
  1434. {
  1435. $$.setExpr(createValue(no_success, $3.getExpr(), NULL), $1);
  1436. }
  1437. | RECOVERY '(' action ')'
  1438. {
  1439. $$.setExpr(createValue(no_recovery, $3.getExpr(), createConstant(1)), $1);
  1440. }
  1441. | RECOVERY '(' action ',' expression ')'
  1442. {
  1443. parser->normalizeExpression($5, type_int, true);
  1444. $$.setExpr(createValue(no_recovery, $3.getExpr(), $5.getExpr()), $1);
  1445. }
  1446. | WHEN '(' event ')'
  1447. {
  1448. parser->checkConstantEvent($3);
  1449. $$.setExpr(createValue(no_when, $3.getExpr()), $1);
  1450. }
  1451. | WHEN '(' event ',' COUNT '(' expression ')' ')'
  1452. {
  1453. parser->checkConstantEvent($3);
  1454. parser->normalizeExpression($7, type_int, true);
  1455. $$.setExpr(createValue(no_when, $3.getExpr(), $7.getExpr()), $1);
  1456. }
  1457. | PRIORITY '(' expression ')'
  1458. {
  1459. parser->normalizeExpression($3, type_int, true);
  1460. $$.setExpr(createValue(no_priority, $3.getExpr()), $1);
  1461. }
  1462. | PERSIST '(' expression ')'
  1463. {
  1464. parser->normalizeExpression($3, type_string, true);
  1465. $$.setExpr(createValueF(no_persist, makeVoidType(), $3.getExpr(), NULL), $1);
  1466. }
  1467. | PERSIST '(' expression ',' persistOpts ')'
  1468. {
  1469. parser->normalizeExpression($3, type_string, true);
  1470. $$.setExpr(createValueF(no_persist, makeVoidType(), $3.getExpr(), $5.getExpr(), NULL), $1);
  1471. }
  1472. | PERSIST '(' expression ',' expression optPersistOpts ')'
  1473. {
  1474. parser->normalizeExpression($3, type_string, true);
  1475. parser->normalizeExpression($5, type_string, true);
  1476. $$.setExpr(createValueF(no_persist, makeVoidType(), $3.getExpr(), $5.getExpr(), $6.getExpr(), NULL), $1);
  1477. }
  1478. | STORED '(' expression optFewMany ')'
  1479. {
  1480. parser->normalizeStoredNameExpression($3);
  1481. $$.setExpr(createValue(no_stored, makeVoidType(), $3.getExpr(), $4.getExpr()), $1);
  1482. }
  1483. | CHECKPOINT '(' constExpression ')'
  1484. {
  1485. parser->normalizeStoredNameExpression($3);
  1486. $$.setExpr(createValue(no_checkpoint, makeVoidType(), $3.getExpr()), $1);
  1487. }
  1488. | GLOBAL
  1489. {
  1490. $$.setExpr(createValue(no_global), $1);
  1491. }
  1492. | GLOBAL '(' fewMany ')'
  1493. {
  1494. $$.setExpr(createValue(no_global, $3.getExpr()), $

Large files files are truncated, but you can click here to view the full file