Qt 4.8
qdeclarativejsast_p.h
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/legal
5 **
6 ** This file is part of the QtDeclarative module of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia. For licensing terms and
14 ** conditions see http://qt.digia.com/licensing. For further information
15 ** use the contact form at http://qt.digia.com/contact-us.
16 **
17 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 **
25 ** In addition, as a special exception, Digia gives you certain additional
26 ** rights. These rights are described in the Digia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 **
29 ** GNU General Public License Usage
30 ** Alternatively, this file may be used under the terms of the GNU
31 ** General Public License version 3.0 as published by the Free Software
32 ** Foundation and appearing in the file LICENSE.GPL included in the
33 ** packaging of this file. Please review the following information to
34 ** ensure the GNU General Public License version 3.0 requirements will be
35 ** met: http://www.gnu.org/copyleft/gpl.html.
36 **
37 **
38 ** $QT_END_LICENSE$
39 **
40 ****************************************************************************/
41 
42 #ifndef QDECLARATIVEJSAST_P_H
43 #define QDECLARATIVEJSAST_P_H
44 
45 //
46 // W A R N I N G
47 // -------------
48 //
49 // This file is not part of the Qt API. It exists purely as an
50 // implementation detail. This header file may change from version to
51 // version without notice, or even be removed.
52 //
53 // We mean it.
54 //
55 
56 #include "private/qdeclarativejsastvisitor_p.h"
57 #include "private/qdeclarativejsglobal_p.h"
58 
59 #include <QtCore/QString>
60 
62 
63 #define QDECLARATIVEJS_DECLARE_AST_NODE(name) \
64  enum { K = Kind_##name };
65 
66 namespace QSOperator // ### rename
67 {
68 
69 enum Op {
70  Add,
71  And,
78  Div,
81  Ge,
82  Gt,
83  In,
86  Le,
89  Lt,
90  Mod,
92  Mul,
95  Or,
105 };
106 
107 } // namespace QSOperator
108 
109 namespace QDeclarativeJS {
110 class NameId;
111 namespace AST {
112 
113 template <typename _T1, typename _T2>
114 _T1 cast(_T2 *ast)
115 {
116  if (ast && ast->kind == static_cast<_T1>(0)->K)
117  return static_cast<_T1>(ast);
118 
119  return 0;
120 }
121 
123 {
124 public:
125  enum Kind {
127 
204 
221  Kind_UiSignature
222  };
223 
224  inline Node()
225  : kind(Kind_Undefined) {}
226 
227  // NOTE: node destructors are never called,
228  // instead we block free the memory
229  // (see the NodePool class)
230  virtual ~Node() {}
231 
232  virtual ExpressionNode *expressionCast();
233  virtual BinaryExpression *binaryExpressionCast();
234  virtual Statement *statementCast();
235  virtual UiObjectMember *uiObjectMemberCast();
236 
237  void accept(Visitor *visitor);
238  static void accept(Node *node, Visitor *visitor);
239 
240  inline static void acceptChild(Node *node, Visitor *visitor)
241  { return accept(node, visitor); } // ### remove
242 
243  virtual void accept0(Visitor *visitor) = 0;
244 
245 // attributes
246  int kind;
247 };
248 
250 {
251 public:
253 
254  virtual ExpressionNode *expressionCast();
255 
256  virtual SourceLocation firstSourceLocation() const = 0;
257  virtual SourceLocation lastSourceLocation() const = 0;
258 };
259 
261 {
262 public:
264 
265  virtual Statement *statementCast();
266 
267  virtual SourceLocation firstSourceLocation() const = 0;
268  virtual SourceLocation lastSourceLocation() const = 0;
269 };
270 
272 {
273 public:
275 
276  UiFormal(NameId *name, NameId *alias = 0)
277  : name(name), alias(alias)
278  { }
279 
281  { return SourceLocation(); }
282 
284  { return SourceLocation(); }
285 
286  virtual void accept0(Visitor *visitor);
287 
288 // attributes
294 };
295 
297 {
298 public:
300 
302  : formal(formal), next(this) {}
303 
304  UiFormalList(UiFormalList *previous, UiFormal *formal)
305  : formal(formal)
306  {
307  next = previous->next;
308  previous->next = this;
309  }
310 
312  {
313  UiFormalList *head = next;
314  next = 0;
315  return head;
316  }
317 
319  { return SourceLocation(); }
320 
322  { return SourceLocation(); }
323 
324  virtual void accept0(Visitor *visitor);
325 
326 // attributes
329 };
330 
332 {
333 public:
335 
336  UiSignature(UiFormalList *formals = 0)
337  : formals(formals)
338  { }
339 
341  { return SourceLocation(); }
342 
344  { return SourceLocation(); }
345 
346  virtual void accept0(Visitor *visitor);
347 
348 // attributes
352 };
353 
355 {
356 public:
358 
360  : expression(expression)
361  { kind = K; }
362 
363  virtual void accept0(Visitor *visitor);
364 
366  { return lparenToken; }
367 
369  { return rparenToken; }
370 
371 // attributes
375 };
376 
378 {
379 public:
381 
382  ThisExpression() { kind = K; }
383 
384  virtual void accept0(Visitor *visitor);
385 
387  { return thisToken; }
388 
390  { return thisToken; }
391 
392 // attributes
394 };
395 
397 {
398 public:
400 
402  name (n) { kind = K; }
403 
404  virtual void accept0(Visitor *visitor);
405 
407  { return identifierToken; }
408 
410  { return identifierToken; }
411 
412 // attributes
415 };
416 
418 {
419 public:
421 
422  NullExpression() { kind = K; }
423 
424  virtual void accept0(Visitor *visitor);
425 
427  { return nullToken; }
428 
430  { return nullToken; }
431 
432 // attributes
434 };
435 
437 {
438 public:
440 
441  TrueLiteral() { kind = K; }
442 
443  virtual void accept0(Visitor *visitor);
444 
446  { return trueToken; }
447 
449  { return trueToken; }
450 
451 // attributes
453 };
454 
456 {
457 public:
459 
460  FalseLiteral() { kind = K; }
461 
462  virtual void accept0(Visitor *visitor);
463 
465  { return falseToken; }
466 
468  { return falseToken; }
469 
470 // attributes
472 };
473 
475 {
476 public:
478 
479  NumericLiteral(double v):
480  value(v) { kind = K; }
481 
482  virtual void accept0(Visitor *visitor);
483 
485  { return literalToken; }
486 
488  { return literalToken; }
489 
490 // attributes:
491  double value;
493 };
494 
496 {
497 public:
499 
501  value (v) { kind = K; }
502 
503  virtual void accept0(Visitor *visitor);
504 
506  { return literalToken; }
507 
509  { return literalToken; }
510 
511 // attributes:
514 };
515 
517 {
518 public:
520 
521  RegExpLiteral(NameId *p, int f):
522  pattern (p), flags (f) { kind = K; }
523 
524  virtual void accept0(Visitor *visitor);
525 
527  { return literalToken; }
528 
530  { return literalToken; }
531 
532 // attributes:
534  int flags;
536 };
537 
539 {
540 public:
542 
544  elements (0), elision (e)
545  { kind = K; }
546 
548  elements (elts), elision (0)
549  { kind = K; }
550 
552  elements (elts), elision (e)
553  { kind = K; }
554 
555  virtual void accept0(Visitor *visitor);
556 
558  { return lbracketToken; }
559 
561  { return rbracketToken; }
562 
563 // attributes
569 };
570 
572 {
573 public:
575 
577  properties (0) { kind = K; }
578 
580  properties (plist) { kind = K; }
581 
582  virtual void accept0(Visitor *visitor);
583 
585  { return lbraceToken; }
586 
588  { return rbraceToken; }
589 
590 // attributes
594 };
595 
597 {
598 public:
600 
602  elision (e), expression (expr), next (this)
603  { kind = K; }
604 
606  elision (e), expression (expr)
607  {
608  kind = K;
609  next = previous->next;
610  previous->next = this;
611  }
612 
613  inline ElementList *finish ()
614  {
615  ElementList *front = next;
616  next = 0;
617  return front;
618  }
619 
620  virtual void accept0(Visitor *visitor);
621 
622 // attributes
627 };
628 
630 {
631 public:
633 
635  next (this) { kind = K; }
636 
637  Elision(Elision *previous)
638  {
639  kind = K;
640  next = previous->next;
641  previous->next = this;
642  }
643 
644  virtual void accept0(Visitor *visitor);
645 
646  inline Elision *finish ()
647  {
648  Elision *front = next;
649  next = 0;
650  return front;
651  }
652 
653 // attributes
656 };
657 
659 {
660 public:
662 
664  name (n), value (v), next (this)
665  { kind = K; }
666 
668  name (n), value (v)
669  {
670  kind = K;
671  next = previous->next;
672  previous->next = this;
673  }
674 
675  virtual void accept0(Visitor *visitor);
676 
678  {
679  PropertyNameAndValueList *front = next;
680  next = 0;
681  return front;
682  }
683 
684 // attributes
690 };
691 
693 {
694 public:
696 
697  PropertyName() { kind = K; }
698 
699 // attributes
701 };
702 
704 {
705 public:
707 
709  id (n) { kind = K; }
710 
711  virtual void accept0(Visitor *visitor);
712 
713 // attributes
715 };
716 
718 {
719 public:
721 
723  id (n) { kind = K; }
724 
725  virtual void accept0(Visitor *visitor);
726 
727 // attributes
729 };
730 
732 {
733 public:
735 
737  id (n) { kind = K; }
738 
739  virtual void accept0(Visitor *visitor);
740 
741 // attributes
742  double id;
743 };
744 
746 {
747 public:
749 
751  base (b), expression (e)
752  { kind = K; }
753 
754  virtual void accept0(Visitor *visitor);
755 
757  { return base->firstSourceLocation(); }
758 
760  { return rbracketToken; }
761 
762 // attributes
767 };
768 
770 {
771 public:
773 
775  base (b), name (n)
776  { kind = K; }
777 
778  virtual void accept0(Visitor *visitor);
779 
781  { return base->firstSourceLocation(); }
782 
784  { return identifierToken; }
785 
786  // attributes
791 };
792 
794 {
795 public:
797 
799  base (b), arguments (a)
800  { kind = K; }
801 
802  virtual void accept0(Visitor *visitor);
803 
805  { return newToken; }
806 
808  { return rparenToken; }
809 
810  // attributes
816 };
817 
819 {
820 public:
822 
824  expression (e) { kind = K; }
825 
826  virtual void accept0(Visitor *visitor);
827 
829  { return newToken; }
830 
832  { return expression->lastSourceLocation(); }
833 
834 // attributes
837 };
838 
840 {
841 public:
843 
845  base (b), arguments (a)
846  { kind = K; }
847 
848  virtual void accept0(Visitor *visitor);
849 
851  { return base->firstSourceLocation(); }
852 
854  { return rparenToken; }
855 
856 // attributes
861 };
862 
864 {
865 public:
867 
869  expression (e), next (this)
870  { kind = K; }
871 
873  expression (e)
874  {
875  kind = K;
876  next = previous->next;
877  previous->next = this;
878  }
879 
880  virtual void accept0(Visitor *visitor);
881 
882  inline ArgumentList *finish ()
883  {
884  ArgumentList *front = next;
885  next = 0;
886  return front;
887  }
888 
889 // attributes
893 };
894 
896 {
897 public:
899 
901  base (b) { kind = K; }
902 
903  virtual void accept0(Visitor *visitor);
904 
906  { return base->firstSourceLocation(); }
907 
909  { return incrementToken; }
910 
911 // attributes
914 };
915 
917 {
918 public:
920 
922  base (b) { kind = K; }
923 
924  virtual void accept0(Visitor *visitor);
925 
927  { return base->firstSourceLocation(); }
928 
930  { return decrementToken; }
931 
932 // attributes
935 };
936 
938 {
939 public:
941 
943  expression (e) { kind = K; }
944 
945  virtual void accept0(Visitor *visitor);
946 
948  { return deleteToken; }
949 
951  { return expression->lastSourceLocation(); }
952 
953 // attributes
956 };
957 
959 {
960 public:
962 
964  expression (e) { kind = K; }
965 
966  virtual void accept0(Visitor *visitor);
967 
969  { return voidToken; }
970 
972  { return expression->lastSourceLocation(); }
973 
974 // attributes
977 };
978 
980 {
981 public:
983 
985  expression (e) { kind = K; }
986 
987  virtual void accept0(Visitor *visitor);
988 
990  { return typeofToken; }
991 
993  { return expression->lastSourceLocation(); }
994 
995 // attributes
998 };
999 
1001 {
1002 public:
1004 
1006  expression (e) { kind = K; }
1007 
1008  virtual void accept0(Visitor *visitor);
1009 
1011  { return incrementToken; }
1012 
1014  { return expression->lastSourceLocation(); }
1015 
1016 // attributes
1019 };
1020 
1022 {
1023 public:
1025 
1027  expression (e) { kind = K; }
1028 
1029  virtual void accept0(Visitor *visitor);
1030 
1032  { return decrementToken; }
1033 
1035  { return expression->lastSourceLocation(); }
1036 
1037 // attributes
1040 };
1041 
1043 {
1044 public:
1046 
1048  expression (e) { kind = K; }
1049 
1050  virtual void accept0(Visitor *visitor);
1051 
1053  { return plusToken; }
1054 
1056  { return expression->lastSourceLocation(); }
1057 
1058 // attributes
1061 };
1062 
1064 {
1065 public:
1067 
1069  expression (e) { kind = K; }
1070 
1071  virtual void accept0(Visitor *visitor);
1072 
1074  { return minusToken; }
1075 
1077  { return expression->lastSourceLocation(); }
1078 
1079 // attributes
1082 };
1083 
1085 {
1086 public:
1088 
1090  expression (e) { kind = K; }
1091 
1092  virtual void accept0(Visitor *visitor);
1093 
1095  { return tildeToken; }
1096 
1098  { return expression->lastSourceLocation(); }
1099 
1100 // attributes
1103 };
1104 
1106 {
1107 public:
1109 
1111  expression (e) { kind = K; }
1112 
1113  virtual void accept0(Visitor *visitor);
1114 
1116  { return notToken; }
1117 
1119  { return expression->lastSourceLocation(); }
1120 
1121 // attributes
1124 };
1125 
1127 {
1128 public:
1130 
1132  left (l), op (o), right (r)
1133  { kind = K; }
1134 
1135  virtual BinaryExpression *binaryExpressionCast();
1136 
1137  virtual void accept0(Visitor *visitor);
1138 
1140  { return left->firstSourceLocation(); }
1141 
1143  { return right->lastSourceLocation(); }
1144 
1145 // attributes
1147  int op;
1150 };
1151 
1153 {
1154 public:
1156 
1158  expression (e), ok (t), ko (f)
1159  { kind = K; }
1160 
1161  virtual void accept0(Visitor *visitor);
1162 
1164  { return expression->firstSourceLocation(); }
1165 
1167  { return ko->lastSourceLocation(); }
1168 
1169 // attributes
1175 };
1176 
1177 class QML_PARSER_EXPORT Expression: public ExpressionNode // ### rename
1178 {
1179 public:
1181 
1183  left (l), right (r) { kind = K; }
1184 
1185  virtual void accept0(Visitor *visitor);
1186 
1188  { return left->firstSourceLocation(); }
1189 
1191  { return right->lastSourceLocation(); }
1192 
1193 // attributes
1197 };
1198 
1200 {
1201 public:
1203 
1205  statements (slist) { kind = K; }
1206 
1207  virtual void accept0(Visitor *visitor);
1208 
1210  { return lbraceToken; }
1211 
1213  { return rbraceToken; }
1214 
1215  // attributes
1219 };
1220 
1222 {
1223 public:
1225 
1227  statement (stmt), next (this)
1228  { kind = K; }
1229 
1231  statement (stmt)
1232  {
1233  kind = K;
1234  next = previous->next;
1235  previous->next = this;
1236  }
1237 
1238  virtual void accept0(Visitor *visitor);
1239 
1241  {
1242  StatementList *front = next;
1243  next = 0;
1244  return front;
1245  }
1246 
1247 // attributes
1250 };
1251 
1253 {
1254 public:
1256 
1258  declarations (vlist)
1259  { kind = K; }
1260 
1261  virtual void accept0(Visitor *visitor);
1262 
1264  { return declarationKindToken; }
1265 
1267  { return semicolonToken; }
1268 
1269 // attributes
1273 };
1274 
1276 {
1277 public:
1279 
1281  name (n), expression (e), readOnly(false)
1282  { kind = K; }
1283 
1284  virtual void accept0(Visitor *visitor);
1285 
1286 // attributes
1289  bool readOnly;
1291 };
1292 
1294 {
1295 public:
1297 
1299  declaration (decl), next (this)
1300  { kind = K; }
1301 
1303  declaration (decl)
1304  {
1305  kind = K;
1306  next = previous->next;
1307  previous->next = this;
1308  }
1309 
1310  virtual void accept0(Visitor *visitor);
1311 
1312  inline VariableDeclarationList *finish (bool readOnly)
1313  {
1314  VariableDeclarationList *front = next;
1315  next = 0;
1316  if (readOnly) {
1318  for (vdl = front; vdl != 0; vdl = vdl->next)
1319  vdl->declaration->readOnly = true;
1320  }
1321  return front;
1322  }
1323 
1324 // attributes
1328 };
1329 
1331 {
1332 public:
1334 
1335  EmptyStatement() { kind = K; }
1336 
1337  virtual void accept0(Visitor *visitor);
1338 
1340  { return semicolonToken; }
1341 
1343  { return semicolonToken; }
1344 
1345 // attributes
1347 };
1348 
1350 {
1351 public:
1353 
1355  expression (e) { kind = K; }
1356 
1357  virtual void accept0(Visitor *visitor);
1358 
1360  { return expression->firstSourceLocation(); }
1361 
1363  { return semicolonToken; }
1364 
1365 // attributes
1368 };
1369 
1371 {
1372 public:
1374 
1376  expression (e), ok (t), ko (f)
1377  { kind = K; }
1378 
1379  virtual void accept0(Visitor *visitor);
1380 
1382  { return ifToken; }
1383 
1385  {
1386  if (ko)
1387  return ko->lastSourceLocation();
1388 
1389  return ok->lastSourceLocation();
1390  }
1391 
1392 // attributes
1400 };
1401 
1403 {
1404 public:
1406 
1408  statement (stmt), expression (e)
1409  { kind = K; }
1410 
1411  virtual void accept0(Visitor *visitor);
1412 
1414  { return doToken; }
1415 
1417  { return semicolonToken; }
1418 
1419 // attributes
1427 };
1428 
1430 {
1431 public:
1433 
1435  expression (e), statement (stmt)
1436  { kind = K; }
1437 
1438  virtual void accept0(Visitor *visitor);
1439 
1441  { return whileToken; }
1442 
1444  { return statement->lastSourceLocation(); }
1445 
1446 // attributes
1452 };
1453 
1455 {
1456 public:
1458 
1460  initialiser (i), condition (c), expression (e), statement (stmt)
1461  { kind = K; }
1462 
1463  virtual void accept0(Visitor *visitor);
1464 
1466  { return forToken; }
1467 
1469  { return statement->lastSourceLocation(); }
1470 
1471 // attributes
1481 };
1482 
1484 {
1485 public:
1487 
1489  declarations (vlist), condition (c), expression (e), statement (stmt)
1490  { kind = K; }
1491 
1492  virtual void accept0(Visitor *visitor);
1493 
1495  { return forToken; }
1496 
1498  { return statement->lastSourceLocation(); }
1499 
1500 // attributes
1511 };
1512 
1514 {
1515 public:
1517 
1519  initialiser (i), expression (e), statement (stmt)
1520  { kind = K; }
1521 
1522  virtual void accept0(Visitor *visitor);
1523 
1525  { return forToken; }
1526 
1528  { return statement->lastSourceLocation(); }
1529 
1530 // attributes
1538 };
1539 
1541 {
1542 public:
1544 
1546  declaration (v), expression (e), statement (stmt)
1547  { kind = K; }
1548 
1549  virtual void accept0(Visitor *visitor);
1550 
1552  { return forToken; }
1553 
1555  { return statement->lastSourceLocation(); }
1556 
1557 // attributes
1566 };
1567 
1569 {
1570 public:
1572 
1574  label (l) { kind = K; }
1575 
1576  virtual void accept0(Visitor *visitor);
1577 
1579  { return continueToken; }
1580 
1582  { return semicolonToken; }
1583 
1584 // attributes
1589 };
1590 
1592 {
1593 public:
1595 
1597  label (l) { kind = K; }
1598 
1599  virtual void accept0(Visitor *visitor);
1600 
1602  { return breakToken; }
1603 
1605  { return semicolonToken; }
1606 
1607  // attributes
1612 };
1613 
1615 {
1616 public:
1618 
1620  expression (e) { kind = K; }
1621 
1622  virtual void accept0(Visitor *visitor);
1623 
1625  { return returnToken; }
1626 
1628  { return semicolonToken; }
1629 
1630 // attributes
1634 };
1635 
1637 {
1638 public:
1640 
1642  expression (e), statement (stmt)
1643  { kind = K; }
1644 
1645  virtual void accept0(Visitor *visitor);
1646 
1648  { return withToken; }
1649 
1651  { return statement->lastSourceLocation(); }
1652 
1653 // attributes
1659 };
1660 
1662 {
1663 public:
1665 
1667  clauses (c), defaultClause (d), moreClauses (r)
1668  { kind = K; }
1669 
1670  virtual void accept0(Visitor *visitor);
1671 
1672 // attributes
1678 };
1679 
1681 {
1682 public:
1684 
1686  expression (e), block (b)
1687  { kind = K; }
1688 
1689  virtual void accept0(Visitor *visitor);
1690 
1692  { return switchToken; }
1693 
1695  { return block->rbraceToken; }
1696 
1697 // attributes
1703 };
1704 
1706 {
1707 public:
1709 
1711  clause (c), next (this)
1712  { kind = K; }
1713 
1715  clause (c)
1716  {
1717  kind = K;
1718  next = previous->next;
1719  previous->next = this;
1720  }
1721 
1722  virtual void accept0(Visitor *visitor);
1723 
1724  inline CaseClauses *finish ()
1725  {
1726  CaseClauses *front = next;
1727  next = 0;
1728  return front;
1729  }
1730 
1731 //attributes
1734 };
1735 
1737 {
1738 public:
1740 
1742  expression (e), statements (slist)
1743  { kind = K; }
1744 
1745  virtual void accept0(Visitor *visitor);
1746 
1747 // attributes
1752 };
1753 
1755 {
1756 public:
1758 
1760  statements (slist)
1761  { kind = K; }
1762 
1763  virtual void accept0(Visitor *visitor);
1764 
1765 // attributes
1769 };
1770 
1772 {
1773 public:
1775 
1777  label (l), statement (stmt)
1778  { kind = K; }
1779 
1780  virtual void accept0(Visitor *visitor);
1781 
1783  { return identifierToken; }
1784 
1786  { return statement->lastSourceLocation(); }
1787 
1788 // attributes
1793 };
1794 
1796 {
1797 public:
1799 
1801  expression (e) { kind = K; }
1802 
1803  virtual void accept0(Visitor *visitor);
1804 
1806  { return throwToken; }
1807 
1809  { return semicolonToken; }
1810 
1811  // attributes
1815 };
1816 
1818 {
1819 public:
1821 
1822  Catch(NameId *n, Block *stmt):
1823  name (n), statement (stmt)
1824  { kind = K; }
1825 
1826  virtual void accept0(Visitor *visitor);
1827 
1828 // attributes
1835 };
1836 
1838 {
1839 public:
1841 
1842  Finally(Block *stmt):
1843  statement (stmt)
1844  { kind = K; }
1845 
1846  virtual void accept0(Visitor *visitor);
1847 
1848 // attributes
1851 };
1852 
1854 {
1855 public:
1857 
1859  statement (stmt), catchExpression (c), finallyExpression (f)
1860  { kind = K; }
1861 
1863  statement (stmt), catchExpression (0), finallyExpression (f)
1864  { kind = K; }
1865 
1867  statement (stmt), catchExpression (c), finallyExpression (0)
1868  { kind = K; }
1869 
1870  virtual void accept0(Visitor *visitor);
1871 
1873  { return tryToken; }
1874 
1876  {
1877  if (finallyExpression)
1878  return finallyExpression->statement->rbraceToken;
1879  else if (catchExpression)
1880  return catchExpression->statement->rbraceToken;
1881 
1882  return statement->lastSourceLocation();
1883  }
1884 
1885 // attributes
1890 };
1891 
1893 {
1894 public:
1896 
1898  name (n), formals (f), body (b)
1899  { kind = K; }
1900 
1901  virtual void accept0(Visitor *visitor);
1902 
1904  { return functionToken; }
1905 
1907  { return rbraceToken; }
1908 
1909 // attributes
1919 };
1920 
1922 {
1923 public:
1925 
1927  FunctionExpression(n, f, b)
1928  { kind = K; }
1929 
1930  virtual void accept0(Visitor *visitor);
1931 };
1932 
1934 {
1935 public:
1937 
1939  name (n), next (this)
1940  { kind = K; }
1941 
1943  name (n)
1944  {
1945  kind = K;
1946  next = previous->next;
1947  previous->next = this;
1948  }
1949 
1950  virtual void accept0(Visitor *visitor);
1951 
1953  {
1954  FormalParameterList *front = next;
1955  next = 0;
1956  return front;
1957  }
1958 
1959 // attributes
1964 };
1965 
1967 {
1968 public:
1970 
1972  elements (elts)
1973  { kind = K; }
1974 
1975  virtual void accept0(Visitor *visitor);
1976 
1977 // attributes
1979 };
1980 
1982 {
1983 public:
1985 
1987  elements (elts)
1988  { kind = K; }
1989 
1990  virtual void accept0(Visitor *visitor);
1991 
1992 // attributes
1994 };
1995 
1997 {
1998 public:
2000 
2002  element (elt), next (this)
2003  { kind = K; }
2004 
2006  element (elt)
2007  {
2008  kind = K;
2009  next = previous->next;
2010  previous->next = this;
2011  }
2012 
2013  virtual void accept0(Visitor *visitor);
2014 
2016  {
2017  SourceElements *front = next;
2018  next = 0;
2019  return front;
2020  }
2021 
2022 // attributes
2025 };
2026 
2028 {
2029 public:
2031 
2032  inline SourceElement()
2033  { kind = K; }
2034 };
2035 
2037 {
2038 public:
2040 
2042  declaration (f)
2043  { kind = K; }
2044 
2045  virtual void accept0(Visitor *visitor);
2046 
2047 // attributes
2049 };
2050 
2052 {
2053 public:
2055 
2057  statement (stmt)
2058  { kind = K; }
2059 
2060  virtual void accept0(Visitor *visitor);
2061 
2062 // attributes
2064 };
2065 
2067 {
2068 public:
2070 
2072  { kind = K; }
2073 
2074  virtual void accept0(Visitor *visitor);
2075 
2077  { return debuggerToken; }
2078 
2080  { return semicolonToken; }
2081 
2082 // attributes
2085 };
2086 
2088 {
2089 public:
2091 
2093  : imports(imports), members(members)
2094  { kind = K; }
2095 
2096  virtual void accept0(Visitor *visitor);
2097 
2098 // attributes
2101 };
2102 
2104 {
2105 public:
2107 
2109  : next(this), name(name)
2110  { kind = K; }
2111 
2113  : name(name)
2114  {
2115  kind = K;
2116  next = previous->next;
2117  previous->next = this;
2118  }
2119 
2121  {
2122  UiQualifiedId *head = next;
2123  next = 0;
2124  return head;
2125  }
2126 
2127  virtual void accept0(Visitor *visitor);
2128 
2129 // attributes
2133 };
2134 
2136 {
2137 public:
2139 
2141  : fileName(fileName), importUri(0), importId(0)
2142  { kind = K; }
2143 
2145  : fileName(0), importUri(uri), importId(0)
2146  { kind = K; }
2147 
2149  { return importToken; }
2150 
2152  { return semicolonToken; }
2153 
2154  virtual void accept0(Visitor *visitor);
2155 
2156 // attributes
2166 };
2167 
2169 {
2170 public:
2172 
2174  : import(import),
2175  next(this)
2176  { kind = K; }
2177 
2178  UiImportList(UiImportList *previous, UiImport *import)
2179  : import(import)
2180  {
2181  kind = K;
2182  next = previous->next;
2183  previous->next = this;
2184  }
2185 
2187  {
2188  if (import) return import->firstSourceLocation();
2189  else return SourceLocation();
2190  }
2191 
2193  {
2194  for (const UiImportList *it = this; it; it = it->next)
2195  if (!it->next && it->import)
2196  return it->import->lastSourceLocation();
2197 
2198  return SourceLocation();
2199  }
2200 
2202  {
2203  UiImportList *head = next;
2204  next = 0;
2205  return head;
2206  }
2207 
2208  virtual void accept0(Visitor *visitor);
2209 
2210 // attributes
2211  UiImport *import;
2213 };
2214 
2216 {
2217 public:
2218  virtual SourceLocation firstSourceLocation() const = 0;
2219  virtual SourceLocation lastSourceLocation() const = 0;
2220 
2221  virtual UiObjectMember *uiObjectMemberCast();
2222 };
2223 
2225 {
2226 public:
2228 
2230  : next(this), member(member)
2231  { kind = K; }
2232 
2234  : member(member)
2235  {
2236  kind = K;
2237  next = previous->next;
2238  previous->next = this;
2239  }
2240 
2241  virtual void accept0(Visitor *visitor);
2242 
2244  {
2245  UiObjectMemberList *head = next;
2246  next = 0;
2247  return head;
2248  }
2249 
2250 // attributes
2253 };
2254 
2256 {
2257 public:
2259 
2261  : next(this), member(member)
2262  { kind = K; }
2263 
2265  : member(member)
2266  {
2267  kind = K;
2268  next = previous->next;
2269  previous->next = this;
2270  }
2271 
2272  virtual void accept0(Visitor *visitor);
2273 
2275  {
2276  UiArrayMemberList *head = next;
2277  next = 0;
2278  return head;
2279  }
2280 
2281 // attributes
2285 };
2286 
2288 {
2289 public:
2291 
2293  : members(members)
2294  { kind = K; }
2295 
2296  virtual void accept0(Visitor *visitor);
2297 
2298 // attributes
2302 };
2303 
2305 {
2306 public:
2308 
2310  type (t), name (n), next (this)
2311  { kind = K; }
2312 
2314  type (t), name (n)
2315  {
2316  kind = K;
2317  next = previous->next;
2318  previous->next = this;
2319  }
2320 
2321  virtual void accept0(Visitor *) {}
2322 
2324  {
2325  UiParameterList *front = next;
2326  next = 0;
2327  return front;
2328  }
2329 
2330 // attributes
2336 };
2337 
2339 {
2340 public:
2342 
2343  UiPublicMember(NameId *memberType,
2344  NameId *name)
2345  : type(Property), typeModifier(0), memberType(memberType), name(name), expression(0), binding(0), isDefaultMember(false), isReadonlyMember(false), parameters(0)
2346  { kind = K; }
2347 
2348  UiPublicMember(NameId *memberType,
2349  NameId *name,
2350  ExpressionNode *expression)
2351  : type(Property), typeModifier(0), memberType(memberType), name(name), expression(expression), binding(0), isDefaultMember(false), isReadonlyMember(false), parameters(0)
2352  { kind = K; }
2353 
2355  {
2356  if (defaultToken.isValid())
2357  return defaultToken;
2358  else if (readonlyToken.isValid())
2359  return readonlyToken;
2360 
2361  return propertyToken;
2362  }
2363 
2365  {
2366  if (binding)
2367  return binding->lastSourceLocation();
2368 
2369  return semicolonToken;
2370  }
2371 
2372  virtual void accept0(Visitor *visitor);
2373 
2374 // attributes
2375  enum { Signal, Property } type;
2379  ExpressionNode *expression; // initialized with a JS expression
2380  UiObjectMember *binding; // initialized with a QML object or array.
2392 };
2393 
2395 {
2396 public:
2398 
2399  UiObjectDefinition(UiQualifiedId *qualifiedTypeNameId,
2400  UiObjectInitializer *initializer)
2401  : qualifiedTypeNameId(qualifiedTypeNameId), initializer(initializer)
2402  { kind = K; }
2403 
2405  { return qualifiedTypeNameId->identifierToken; }
2406 
2408  { return initializer->rbraceToken; }
2409 
2410  virtual void accept0(Visitor *visitor);
2411 
2412 // attributes
2415 };
2416 
2418 {
2419 public:
2421 
2422  UiSourceElement(Node *sourceElement)
2423  : sourceElement(sourceElement)
2424  { kind = K; }
2425 
2427  {
2428  if (FunctionDeclaration *funDecl = cast<FunctionDeclaration *>(sourceElement))
2429  return funDecl->firstSourceLocation();
2430  else if (VariableStatement *varStmt = cast<VariableStatement *>(sourceElement))
2431  return varStmt->firstSourceLocation();
2432 
2433  return SourceLocation();
2434  }
2435 
2437  {
2438  if (FunctionDeclaration *funDecl = cast<FunctionDeclaration *>(sourceElement))
2439  return funDecl->lastSourceLocation();
2440  else if (VariableStatement *varStmt = cast<VariableStatement *>(sourceElement))
2441  return varStmt->lastSourceLocation();
2442 
2443  return SourceLocation();
2444  }
2445 
2446 
2447  virtual void accept0(Visitor *visitor);
2448 
2449 // attributes
2451 };
2452 
2454 {
2455 public:
2457 
2459  UiQualifiedId *qualifiedTypeNameId,
2460  UiObjectInitializer *initializer)
2461  : qualifiedId(qualifiedId),
2462  qualifiedTypeNameId(qualifiedTypeNameId),
2463  initializer(initializer),
2464  hasOnToken(false)
2465  { kind = K; }
2466 
2468  {
2469  if (hasOnToken && qualifiedTypeNameId)
2470  return qualifiedTypeNameId->identifierToken;
2471 
2472  return qualifiedId->identifierToken;
2473  }
2474 
2476  { return initializer->rbraceToken; }
2477 
2478  virtual void accept0(Visitor *visitor);
2479 
2480 // attributes
2486 };
2487 
2489 {
2490 public:
2492 
2494  Statement *statement)
2495  : qualifiedId(qualifiedId),
2496  statement(statement)
2497  { kind = K; }
2498 
2500  { return qualifiedId->identifierToken; }
2501 
2503  { return statement->lastSourceLocation(); }
2504 
2505  virtual void accept0(Visitor *visitor);
2506 
2507 // attributes
2511 };
2512 
2514 {
2515 public:
2517 
2519  UiArrayMemberList *members)
2520  : qualifiedId(qualifiedId),
2521  members(members)
2522  { kind = K; }
2523 
2525  { return qualifiedId->identifierToken; }
2526 
2528  { return rbracketToken; }
2529 
2530  virtual void accept0(Visitor *visitor);
2531 
2532 // attributes
2538 };
2539 
2540 } } // namespace AST
2541 
2542 
2543 
2545 
2546 #endif
virtual SourceLocation firstSourceLocation() const
ObjectLiteral(PropertyNameAndValueList *plist)
double d
Definition: qnumeric_p.h:62
virtual SourceLocation lastSourceLocation() const
virtual SourceLocation firstSourceLocation() const
virtual SourceLocation firstSourceLocation() const
virtual SourceLocation lastSourceLocation() const
virtual SourceLocation firstSourceLocation() const
virtual SourceLocation firstSourceLocation() const
virtual SourceLocation lastSourceLocation() const
virtual SourceLocation lastSourceLocation() const
virtual SourceLocation firstSourceLocation() const
virtual SourceLocation lastSourceLocation() const
int type
Definition: qmetatype.cpp:239
virtual SourceLocation lastSourceLocation() const
unsigned char c[8]
Definition: qnumeric_p.h:62
virtual SourceLocation lastSourceLocation() const
virtual SourceLocation firstSourceLocation() const
virtual SourceLocation firstSourceLocation() const
UiImportList(UiImportList *previous, UiImport *import)
virtual SourceLocation firstSourceLocation() const
virtual SourceLocation firstSourceLocation() const
virtual SourceLocation firstSourceLocation() const
virtual SourceLocation firstSourceLocation() const
virtual SourceLocation firstSourceLocation() const
virtual SourceLocation lastSourceLocation() const
UiArrayMemberList(UiArrayMemberList *previous, UiObjectMember *member)
#define it(className, varName)
virtual SourceLocation lastSourceLocation() const
virtual SourceLocation lastSourceLocation() const
virtual SourceLocation lastSourceLocation() const
virtual SourceLocation lastSourceLocation() const
virtual SourceLocation firstSourceLocation() const
virtual SourceLocation firstSourceLocation() const
virtual SourceLocation firstSourceLocation() const
virtual SourceLocation firstSourceLocation() const
virtual SourceLocation firstSourceLocation() const =0
virtual SourceLocation firstSourceLocation() const
virtual SourceLocation firstSourceLocation() const
virtual SourceLocation lastSourceLocation() const
virtual SourceLocation firstSourceLocation() const
virtual SourceLocation lastSourceLocation() const
virtual SourceLocation firstSourceLocation() const
ElementList(ElementList *previous, Elision *e, ExpressionNode *expr)
virtual SourceLocation firstSourceLocation() const
virtual SourceLocation firstSourceLocation() const
virtual SourceLocation firstSourceLocation() const
virtual SourceLocation firstSourceLocation() const
virtual SourceLocation lastSourceLocation() const
virtual SourceLocation lastSourceLocation() const
long ASN1_INTEGER_get ASN1_INTEGER * a
virtual SourceLocation firstSourceLocation() const
virtual SourceLocation lastSourceLocation() const
virtual SourceLocation firstSourceLocation() const
virtual SourceLocation lastSourceLocation() const
virtual SourceLocation lastSourceLocation() const =0
virtual SourceLocation firstSourceLocation() const
virtual SourceLocation firstSourceLocation() const
virtual SourceLocation lastSourceLocation() const
UiParameterList(UiParameterList *previous, NameId *t, NameId *n)
virtual SourceLocation firstSourceLocation() const
static const uint base
Definition: qurl.cpp:268
virtual SourceLocation firstSourceLocation() const
Q_CORE_EXPORT QTextStream & right(QTextStream &s)
virtual SourceLocation firstSourceLocation() const
PropertyNameAndValueList * properties
virtual SourceLocation lastSourceLocation() const
#define QML_PARSER_EXPORT
virtual SourceLocation lastSourceLocation() const
virtual SourceLocation firstSourceLocation() const
virtual SourceLocation firstSourceLocation() const
virtual SourceLocation lastSourceLocation() const
virtual SourceLocation firstSourceLocation() const
virtual SourceLocation lastSourceLocation() const
TryStatement(Statement *stmt, Finally *f)
virtual SourceLocation lastSourceLocation() const
UiQualifiedId(UiQualifiedId *previous, NameId *name)
virtual SourceLocation lastSourceLocation() const
virtual SourceLocation firstSourceLocation() const
virtual SourceLocation lastSourceLocation() const
virtual SourceLocation firstSourceLocation() const
virtual SourceLocation firstSourceLocation() const
virtual SourceLocation lastSourceLocation() const
CaseClauses(CaseClauses *previous, CaseClause *c)
virtual SourceLocation lastSourceLocation() const
virtual SourceLocation lastSourceLocation() const
virtual SourceLocation lastSourceLocation() const =0
virtual SourceLocation lastSourceLocation() const
const char * name
virtual SourceLocation lastSourceLocation() const
virtual SourceLocation lastSourceLocation() const
virtual SourceLocation lastSourceLocation() const
static QVector< Declaration > declarations(const QVector< StyleRule > &styleRules, const QString &part, quint64 pseudoClass=PseudoClass_Unspecified)
#define QT_QML_END_NAMESPACE
virtual SourceLocation lastSourceLocation() const
PropertyNameAndValueList(PropertyNameAndValueList *previous, PropertyName *n, ExpressionNode *v)
VariableDeclarationList(VariableDeclarationList *previous, VariableDeclaration *decl)
virtual SourceLocation lastSourceLocation() const
virtual SourceLocation lastSourceLocation() const
virtual SourceLocation firstSourceLocation() const
SourceElements(SourceElements *previous, SourceElement *elt)
virtual SourceLocation firstSourceLocation() const
virtual SourceLocation lastSourceLocation() const
virtual SourceLocation firstSourceLocation() const
virtual SourceLocation firstSourceLocation() const
#define QT_QML_BEGIN_NAMESPACE
virtual SourceLocation firstSourceLocation() const
virtual SourceLocation lastSourceLocation() const
virtual SourceLocation firstSourceLocation() const
virtual SourceLocation lastSourceLocation() const
virtual SourceLocation firstSourceLocation() const
virtual SourceLocation lastSourceLocation() const
virtual SourceLocation firstSourceLocation() const
virtual SourceLocation lastSourceLocation() const
virtual SourceLocation firstSourceLocation() const
virtual SourceLocation lastSourceLocation() const
ArrayLiteral(ElementList *elts, Elision *e)
virtual SourceLocation lastSourceLocation() const
virtual SourceLocation firstSourceLocation() const
virtual SourceLocation lastSourceLocation() const
virtual SourceLocation firstSourceLocation() const
UiPublicMember(NameId *memberType, NameId *name, ExpressionNode *expression)
UiObjectMemberList(UiObjectMemberList *previous, UiObjectMember *member)
static void acceptChild(Node *node, Visitor *visitor)
virtual SourceLocation lastSourceLocation() const
virtual SourceLocation firstSourceLocation() const
virtual SourceLocation lastSourceLocation() const
virtual SourceLocation firstSourceLocation() const
virtual SourceLocation lastSourceLocation() const
FormalParameterList(FormalParameterList *previous, NameId *n)
virtual SourceLocation lastSourceLocation() const
virtual SourceLocation firstSourceLocation() const
virtual SourceLocation lastSourceLocation() const
virtual SourceLocation firstSourceLocation() const
virtual SourceLocation firstSourceLocation() const
virtual SourceLocation lastSourceLocation() const
virtual SourceLocation lastSourceLocation() const
virtual SourceLocation lastSourceLocation() const
virtual SourceLocation lastSourceLocation() const
virtual SourceLocation lastSourceLocation() const
StatementList(StatementList *previous, Statement *stmt)
QFactoryLoader * l
ArgumentList(ArgumentList *previous, ExpressionNode *e)
static const QCssKnownValue properties[NumProperties - 1]
Definition: qcssparser.cpp:67
static const QTextHtmlElement elements[Html_NumElements]
virtual SourceLocation firstSourceLocation() const
virtual SourceLocation firstSourceLocation() const
virtual SourceLocation lastSourceLocation() const
virtual SourceLocation lastSourceLocation() const
virtual SourceLocation firstSourceLocation() const
#define QDECLARATIVEJS_DECLARE_AST_NODE(name)
virtual SourceLocation lastSourceLocation() const
virtual SourceLocation firstSourceLocation() const
Q_CORE_EXPORT QTextStream & left(QTextStream &s)
virtual SourceLocation lastSourceLocation() const
static QString fileName(const QString &fileUrl)
virtual SourceLocation firstSourceLocation() const
TryStatement(Statement *stmt, Catch *c)
virtual SourceLocation firstSourceLocation() const
VariableDeclarationList * finish(bool readOnly)
virtual SourceLocation firstSourceLocation() const
virtual SourceLocation lastSourceLocation() const
virtual SourceLocation lastSourceLocation() const
virtual SourceLocation lastSourceLocation() const
virtual SourceLocation lastSourceLocation() const
virtual SourceLocation firstSourceLocation() const
UiFormalList(UiFormalList *previous, UiFormal *formal)