|
43 | 43 |
|
44 | 44 | // Unqualified %code blocks.
|
45 | 45 |
|
46 |
| -#include <realm/parser/driver.hpp> |
| 46 | +#include <realm/parser/query_ast.hpp> |
47 | 47 | #include <realm/table.hpp>
|
48 | 48 | using namespace realm;
|
49 | 49 | using namespace realm::query_parser;
|
@@ -204,11 +204,6 @@ namespace yy {
|
204 | 204 | value.YY_MOVE_OR_COPY< CompareType > (YY_MOVE (that.value));
|
205 | 205 | break;
|
206 | 206 |
|
207 |
| - case symbol_kind::SYM_constant: // constant |
208 |
| - case symbol_kind::SYM_primary_key: // primary_key |
209 |
| - value.YY_MOVE_OR_COPY< ConstantNode* > (YY_MOVE (that.value)); |
210 |
| - break; |
211 |
| - |
212 | 207 | case symbol_kind::SYM_distinct: // distinct
|
213 | 208 | case symbol_kind::SYM_distinct_param: // distinct_param
|
214 | 209 | case symbol_kind::SYM_sort: // sort
|
@@ -259,6 +254,11 @@ namespace yy {
|
259 | 254 | value.YY_MOVE_OR_COPY< QueryNode* > (YY_MOVE (that.value));
|
260 | 255 | break;
|
261 | 256 |
|
| 257 | + case symbol_kind::SYM_constant: // constant |
| 258 | + case symbol_kind::SYM_primary_key: // primary_key |
| 259 | + value.YY_MOVE_OR_COPY< StringConstantNode* > (YY_MOVE (that.value)); |
| 260 | + break; |
| 261 | + |
262 | 262 | case symbol_kind::SYM_subquery: // subquery
|
263 | 263 | value.YY_MOVE_OR_COPY< SubqueryNode* > (YY_MOVE (that.value));
|
264 | 264 | break;
|
@@ -348,11 +348,6 @@ namespace yy {
|
348 | 348 | value.move< CompareType > (YY_MOVE (that.value));
|
349 | 349 | break;
|
350 | 350 |
|
351 |
| - case symbol_kind::SYM_constant: // constant |
352 |
| - case symbol_kind::SYM_primary_key: // primary_key |
353 |
| - value.move< ConstantNode* > (YY_MOVE (that.value)); |
354 |
| - break; |
355 |
| - |
356 | 351 | case symbol_kind::SYM_distinct: // distinct
|
357 | 352 | case symbol_kind::SYM_distinct_param: // distinct_param
|
358 | 353 | case symbol_kind::SYM_sort: // sort
|
@@ -403,6 +398,11 @@ namespace yy {
|
403 | 398 | value.move< QueryNode* > (YY_MOVE (that.value));
|
404 | 399 | break;
|
405 | 400 |
|
| 401 | + case symbol_kind::SYM_constant: // constant |
| 402 | + case symbol_kind::SYM_primary_key: // primary_key |
| 403 | + value.move< StringConstantNode* > (YY_MOVE (that.value)); |
| 404 | + break; |
| 405 | + |
406 | 406 | case symbol_kind::SYM_subquery: // subquery
|
407 | 407 | value.move< SubqueryNode* > (YY_MOVE (that.value));
|
408 | 408 | break;
|
@@ -492,11 +492,6 @@ namespace yy {
|
492 | 492 | value.copy< CompareType > (that.value);
|
493 | 493 | break;
|
494 | 494 |
|
495 |
| - case symbol_kind::SYM_constant: // constant |
496 |
| - case symbol_kind::SYM_primary_key: // primary_key |
497 |
| - value.copy< ConstantNode* > (that.value); |
498 |
| - break; |
499 |
| - |
500 | 495 | case symbol_kind::SYM_distinct: // distinct
|
501 | 496 | case symbol_kind::SYM_distinct_param: // distinct_param
|
502 | 497 | case symbol_kind::SYM_sort: // sort
|
@@ -547,6 +542,11 @@ namespace yy {
|
547 | 542 | value.copy< QueryNode* > (that.value);
|
548 | 543 | break;
|
549 | 544 |
|
| 545 | + case symbol_kind::SYM_constant: // constant |
| 546 | + case symbol_kind::SYM_primary_key: // primary_key |
| 547 | + value.copy< StringConstantNode* > (that.value); |
| 548 | + break; |
| 549 | + |
550 | 550 | case symbol_kind::SYM_subquery: // subquery
|
551 | 551 | value.copy< SubqueryNode* > (that.value);
|
552 | 552 | break;
|
@@ -634,11 +634,6 @@ namespace yy {
|
634 | 634 | value.move< CompareType > (that.value);
|
635 | 635 | break;
|
636 | 636 |
|
637 |
| - case symbol_kind::SYM_constant: // constant |
638 |
| - case symbol_kind::SYM_primary_key: // primary_key |
639 |
| - value.move< ConstantNode* > (that.value); |
640 |
| - break; |
641 |
| - |
642 | 637 | case symbol_kind::SYM_distinct: // distinct
|
643 | 638 | case symbol_kind::SYM_distinct_param: // distinct_param
|
644 | 639 | case symbol_kind::SYM_sort: // sort
|
@@ -689,6 +684,11 @@ namespace yy {
|
689 | 684 | value.move< QueryNode* > (that.value);
|
690 | 685 | break;
|
691 | 686 |
|
| 687 | + case symbol_kind::SYM_constant: // constant |
| 688 | + case symbol_kind::SYM_primary_key: // primary_key |
| 689 | + value.move< StringConstantNode* > (that.value); |
| 690 | + break; |
| 691 | + |
692 | 692 | case symbol_kind::SYM_subquery: // subquery
|
693 | 693 | value.move< SubqueryNode* > (that.value);
|
694 | 694 | break;
|
@@ -1175,11 +1175,11 @@ namespace yy {
|
1175 | 1175 | break;
|
1176 | 1176 |
|
1177 | 1177 | case symbol_kind::SYM_constant: // constant
|
1178 |
| - { yyo << yysym.value.template as < ConstantNode* > (); } |
| 1178 | + { yyo << yysym.value.template as < StringConstantNode* > (); } |
1179 | 1179 | break;
|
1180 | 1180 |
|
1181 | 1181 | case symbol_kind::SYM_primary_key: // primary_key
|
1182 |
| - { yyo << yysym.value.template as < ConstantNode* > (); } |
| 1182 | + { yyo << yysym.value.template as < StringConstantNode* > (); } |
1183 | 1183 | break;
|
1184 | 1184 |
|
1185 | 1185 | case symbol_kind::SYM_boolexpr: // boolexpr
|
@@ -1456,11 +1456,6 @@ namespace yy {
|
1456 | 1456 | yylhs.value.emplace< CompareType > ();
|
1457 | 1457 | break;
|
1458 | 1458 |
|
1459 |
| - case symbol_kind::SYM_constant: // constant |
1460 |
| - case symbol_kind::SYM_primary_key: // primary_key |
1461 |
| - yylhs.value.emplace< ConstantNode* > (); |
1462 |
| - break; |
1463 |
| - |
1464 | 1459 | case symbol_kind::SYM_distinct: // distinct
|
1465 | 1460 | case symbol_kind::SYM_distinct_param: // distinct_param
|
1466 | 1461 | case symbol_kind::SYM_sort: // sort
|
@@ -1511,6 +1506,11 @@ namespace yy {
|
1511 | 1506 | yylhs.value.emplace< QueryNode* > ();
|
1512 | 1507 | break;
|
1513 | 1508 |
|
| 1509 | + case symbol_kind::SYM_constant: // constant |
| 1510 | + case symbol_kind::SYM_primary_key: // primary_key |
| 1511 | + yylhs.value.emplace< StringConstantNode* > (); |
| 1512 | + break; |
| 1513 | + |
1514 | 1514 | case symbol_kind::SYM_subquery: // subquery
|
1515 | 1515 | yylhs.value.emplace< SubqueryNode* > ();
|
1516 | 1516 | break;
|
@@ -1686,7 +1686,7 @@ namespace yy {
|
1686 | 1686 | break;
|
1687 | 1687 |
|
1688 | 1688 | case 24: // value: constant
|
1689 |
| - { yylhs.value.as < ValueNode* > () = yystack_[0].value.as < ConstantNode* > ();} |
| 1689 | + { yylhs.value.as < ValueNode* > () = yystack_[0].value.as < StringConstantNode* > ();} |
1690 | 1690 | break;
|
1691 | 1691 |
|
1692 | 1692 | case 25: // value: prop
|
@@ -1848,95 +1848,95 @@ namespace yy {
|
1848 | 1848 | break;
|
1849 | 1849 |
|
1850 | 1850 | case 63: // list_content: constant
|
1851 |
| - { yylhs.value.as < ListNode* > () = drv.m_parse_nodes.create<ListNode>(yystack_[0].value.as < ConstantNode* > ()); } |
| 1851 | + { yylhs.value.as < ListNode* > () = drv.m_parse_nodes.create<ListNode>(yystack_[0].value.as < StringConstantNode* > ()); } |
1852 | 1852 | break;
|
1853 | 1853 |
|
1854 | 1854 | case 64: // list_content: %empty
|
1855 | 1855 | { yylhs.value.as < ListNode* > () = drv.m_parse_nodes.create<ListNode>(); }
|
1856 | 1856 | break;
|
1857 | 1857 |
|
1858 | 1858 | case 65: // list_content: list_content ',' constant
|
1859 |
| - { yystack_[2].value.as < ListNode* > ()->add_element(yystack_[0].value.as < ConstantNode* > ()); yylhs.value.as < ListNode* > () = yystack_[2].value.as < ListNode* > (); } |
| 1859 | + { yystack_[2].value.as < ListNode* > ()->add_element(yystack_[0].value.as < StringConstantNode* > ()); yylhs.value.as < ListNode* > () = yystack_[2].value.as < ListNode* > (); } |
1860 | 1860 | break;
|
1861 | 1861 |
|
1862 | 1862 | case 66: // constant: primary_key
|
1863 |
| - { yylhs.value.as < ConstantNode* > () = yystack_[0].value.as < ConstantNode* > (); } |
| 1863 | + { yylhs.value.as < StringConstantNode* > () = yystack_[0].value.as < StringConstantNode* > (); } |
1864 | 1864 | break;
|
1865 | 1865 |
|
1866 | 1866 | case 67: // constant: "infinity"
|
1867 |
| - { yylhs.value.as < ConstantNode* > () = drv.m_parse_nodes.create<ConstantNode>(ConstantNode::INFINITY_VAL, yystack_[0].value.as < std::string > ()); } |
| 1867 | + { yylhs.value.as < StringConstantNode* > () = drv.m_parse_nodes.create<StringConstantNode>(StringConstantNode::INFINITY_VAL, yystack_[0].value.as < std::string > ()); } |
1868 | 1868 | break;
|
1869 | 1869 |
|
1870 | 1870 | case 68: // constant: "NaN"
|
1871 |
| - { yylhs.value.as < ConstantNode* > () = drv.m_parse_nodes.create<ConstantNode>(ConstantNode::NAN_VAL, yystack_[0].value.as < std::string > ()); } |
| 1871 | + { yylhs.value.as < StringConstantNode* > () = drv.m_parse_nodes.create<StringConstantNode>(StringConstantNode::NAN_VAL, yystack_[0].value.as < std::string > ()); } |
1872 | 1872 | break;
|
1873 | 1873 |
|
1874 | 1874 | case 69: // constant: "base64"
|
1875 |
| - { yylhs.value.as < ConstantNode* > () = drv.m_parse_nodes.create<ConstantNode>(ConstantNode::BASE64, yystack_[0].value.as < std::string > ()); } |
| 1875 | + { yylhs.value.as < StringConstantNode* > () = drv.m_parse_nodes.create<StringConstantNode>(StringConstantNode::BASE64, yystack_[0].value.as < std::string > ()); } |
1876 | 1876 | break;
|
1877 | 1877 |
|
1878 | 1878 | case 70: // constant: "float"
|
1879 |
| - { yylhs.value.as < ConstantNode* > () = drv.m_parse_nodes.create<ConstantNode>(ConstantNode::FLOAT, yystack_[0].value.as < std::string > ()); } |
| 1879 | + { yylhs.value.as < StringConstantNode* > () = drv.m_parse_nodes.create<StringConstantNode>(StringConstantNode::FLOAT, yystack_[0].value.as < std::string > ()); } |
1880 | 1880 | break;
|
1881 | 1881 |
|
1882 | 1882 | case 71: // constant: "date"
|
1883 |
| - { yylhs.value.as < ConstantNode* > () = drv.m_parse_nodes.create<ConstantNode>(ConstantNode::TIMESTAMP, yystack_[0].value.as < std::string > ()); } |
| 1883 | + { yylhs.value.as < StringConstantNode* > () = drv.m_parse_nodes.create<StringConstantNode>(StringConstantNode::TIMESTAMP, yystack_[0].value.as < std::string > ()); } |
1884 | 1884 | break;
|
1885 | 1885 |
|
1886 | 1886 | case 72: // constant: "link"
|
1887 |
| - { yylhs.value.as < ConstantNode* > () = drv.m_parse_nodes.create<ConstantNode>(ConstantNode::LINK, yystack_[0].value.as < std::string > ()); } |
| 1887 | + { yylhs.value.as < StringConstantNode* > () = drv.m_parse_nodes.create<StringConstantNode>(StringConstantNode::LINK, yystack_[0].value.as < std::string > ()); } |
1888 | 1888 | break;
|
1889 | 1889 |
|
1890 | 1890 | case 73: // constant: "typed link"
|
1891 |
| - { yylhs.value.as < ConstantNode* > () = drv.m_parse_nodes.create<ConstantNode>(ConstantNode::TYPED_LINK, yystack_[0].value.as < std::string > ()); } |
| 1891 | + { yylhs.value.as < StringConstantNode* > () = drv.m_parse_nodes.create<StringConstantNode>(StringConstantNode::TYPED_LINK, yystack_[0].value.as < std::string > ()); } |
1892 | 1892 | break;
|
1893 | 1893 |
|
1894 | 1894 | case 74: // constant: "true"
|
1895 |
| - { yylhs.value.as < ConstantNode* > () = drv.m_parse_nodes.create<ConstantNode>(ConstantNode::TRUE, ""); } |
| 1895 | + { yylhs.value.as < StringConstantNode* > () = drv.m_parse_nodes.create<StringConstantNode>(StringConstantNode::TRUE, ""); } |
1896 | 1896 | break;
|
1897 | 1897 |
|
1898 | 1898 | case 75: // constant: "false"
|
1899 |
| - { yylhs.value.as < ConstantNode* > () = drv.m_parse_nodes.create<ConstantNode>(ConstantNode::FALSE, ""); } |
| 1899 | + { yylhs.value.as < StringConstantNode* > () = drv.m_parse_nodes.create<StringConstantNode>(StringConstantNode::FALSE, ""); } |
1900 | 1900 | break;
|
1901 | 1901 |
|
1902 | 1902 | case 76: // constant: "null"
|
1903 |
| - { yylhs.value.as < ConstantNode* > () = drv.m_parse_nodes.create<ConstantNode>(ConstantNode::NULL_VAL, ""); } |
| 1903 | + { yylhs.value.as < StringConstantNode* > () = drv.m_parse_nodes.create<StringConstantNode>(StringConstantNode::NULL_VAL, ""); } |
1904 | 1904 | break;
|
1905 | 1905 |
|
1906 | 1906 | case 77: // constant: "argument"
|
1907 |
| - { yylhs.value.as < ConstantNode* > () = drv.m_parse_nodes.create<ConstantNode>(ConstantNode::ARG, yystack_[0].value.as < std::string > ()); } |
| 1907 | + { yylhs.value.as < StringConstantNode* > () = drv.m_parse_nodes.create<StringConstantNode>(StringConstantNode::ARG, yystack_[0].value.as < std::string > ()); } |
1908 | 1908 | break;
|
1909 | 1909 |
|
1910 | 1910 | case 78: // constant: comp_type "argument"
|
1911 |
| - { yylhs.value.as < ConstantNode* > () = drv.m_parse_nodes.create<ConstantNode>(ExpressionComparisonType(yystack_[1].value.as < int > ()), yystack_[0].value.as < std::string > ()); } |
| 1911 | + { yylhs.value.as < StringConstantNode* > () = drv.m_parse_nodes.create<StringConstantNode>(ExpressionComparisonType(yystack_[1].value.as < int > ()), yystack_[0].value.as < std::string > ()); } |
1912 | 1912 | break;
|
1913 | 1913 |
|
1914 | 1914 | case 79: // constant: "obj" '(' "string" ',' primary_key ')'
|
1915 | 1915 | {
|
1916 |
| - auto tmp = yystack_[1].value.as < ConstantNode* > (); |
| 1916 | + auto tmp = yystack_[1].value.as < StringConstantNode* > (); |
1917 | 1917 | tmp->add_table(yystack_[3].value.as < std::string > ());
|
1918 |
| - yylhs.value.as < ConstantNode* > () = tmp; |
| 1918 | + yylhs.value.as < StringConstantNode* > () = tmp; |
1919 | 1919 | }
|
1920 | 1920 | break;
|
1921 | 1921 |
|
1922 | 1922 | case 80: // primary_key: "natural0"
|
1923 |
| - { yylhs.value.as < ConstantNode* > () = drv.m_parse_nodes.create<ConstantNode>(ConstantNode::NUMBER, yystack_[0].value.as < std::string > ()); } |
| 1923 | + { yylhs.value.as < StringConstantNode* > () = drv.m_parse_nodes.create<StringConstantNode>(StringConstantNode::NUMBER, yystack_[0].value.as < std::string > ()); } |
1924 | 1924 | break;
|
1925 | 1925 |
|
1926 | 1926 | case 81: // primary_key: "number"
|
1927 |
| - { yylhs.value.as < ConstantNode* > () = drv.m_parse_nodes.create<ConstantNode>(ConstantNode::NUMBER, yystack_[0].value.as < std::string > ()); } |
| 1927 | + { yylhs.value.as < StringConstantNode* > () = drv.m_parse_nodes.create<StringConstantNode>(StringConstantNode::NUMBER, yystack_[0].value.as < std::string > ()); } |
1928 | 1928 | break;
|
1929 | 1929 |
|
1930 | 1930 | case 82: // primary_key: "string"
|
1931 |
| - { yylhs.value.as < ConstantNode* > () = drv.m_parse_nodes.create<ConstantNode>(ConstantNode::STRING, yystack_[0].value.as < std::string > ()); } |
| 1931 | + { yylhs.value.as < StringConstantNode* > () = drv.m_parse_nodes.create<StringConstantNode>(StringConstantNode::STRING, yystack_[0].value.as < std::string > ()); } |
1932 | 1932 | break;
|
1933 | 1933 |
|
1934 | 1934 | case 83: // primary_key: "UUID"
|
1935 |
| - { yylhs.value.as < ConstantNode* > () = drv.m_parse_nodes.create<ConstantNode>(ConstantNode::UUID_T, yystack_[0].value.as < std::string > ()); } |
| 1935 | + { yylhs.value.as < StringConstantNode* > () = drv.m_parse_nodes.create<StringConstantNode>(StringConstantNode::UUID_T, yystack_[0].value.as < std::string > ()); } |
1936 | 1936 | break;
|
1937 | 1937 |
|
1938 | 1938 | case 84: // primary_key: "ObjectId"
|
1939 |
| - { yylhs.value.as < ConstantNode* > () = drv.m_parse_nodes.create<ConstantNode>(ConstantNode::OID, yystack_[0].value.as < std::string > ()); } |
| 1939 | + { yylhs.value.as < StringConstantNode* > () = drv.m_parse_nodes.create<StringConstantNode>(StringConstantNode::OID, yystack_[0].value.as < std::string > ()); } |
1940 | 1940 | break;
|
1941 | 1941 |
|
1942 | 1942 | case 85: // boolexpr: "truepredicate"
|
|
0 commit comments