Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(101)

Side by Side Diff: src/ast.h

Issue 3812012: Revert revision 5657. (Closed)
Patch Set: Created 10 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/arm/regexp-macro-assembler-arm.cc ('k') | src/ast.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 1505 matching lines...) Expand 10 before | Expand all | Expand 10 after
1516 1516
1517 1517
1518 class RegExpTree: public ZoneObject { 1518 class RegExpTree: public ZoneObject {
1519 public: 1519 public:
1520 static const int kInfinity = kMaxInt; 1520 static const int kInfinity = kMaxInt;
1521 virtual ~RegExpTree() { } 1521 virtual ~RegExpTree() { }
1522 virtual void* Accept(RegExpVisitor* visitor, void* data) = 0; 1522 virtual void* Accept(RegExpVisitor* visitor, void* data) = 0;
1523 virtual RegExpNode* ToNode(RegExpCompiler* compiler, 1523 virtual RegExpNode* ToNode(RegExpCompiler* compiler,
1524 RegExpNode* on_success) = 0; 1524 RegExpNode* on_success) = 0;
1525 virtual bool IsTextElement() { return false; } 1525 virtual bool IsTextElement() { return false; }
1526 virtual bool IsAnchoredAtStart() { return false; } 1526 virtual bool IsAnchored() { return false; }
1527 virtual bool IsAnchoredAtEnd() { return false; }
1528 virtual int min_match() = 0; 1527 virtual int min_match() = 0;
1529 virtual int max_match() = 0; 1528 virtual int max_match() = 0;
1530 // Returns the interval of registers used for captures within this 1529 // Returns the interval of registers used for captures within this
1531 // expression. 1530 // expression.
1532 virtual Interval CaptureRegisters() { return Interval::Empty(); } 1531 virtual Interval CaptureRegisters() { return Interval::Empty(); }
1533 virtual void AppendToText(RegExpText* text); 1532 virtual void AppendToText(RegExpText* text);
1534 SmartPointer<const char> ToString(); 1533 SmartPointer<const char> ToString();
1535 #define MAKE_ASTYPE(Name) \ 1534 #define MAKE_ASTYPE(Name) \
1536 virtual RegExp##Name* As##Name(); \ 1535 virtual RegExp##Name* As##Name(); \
1537 virtual bool Is##Name(); 1536 virtual bool Is##Name();
1538 FOR_EACH_REG_EXP_TREE_TYPE(MAKE_ASTYPE) 1537 FOR_EACH_REG_EXP_TREE_TYPE(MAKE_ASTYPE)
1539 #undef MAKE_ASTYPE 1538 #undef MAKE_ASTYPE
1540 }; 1539 };
1541 1540
1542 1541
1543 class RegExpDisjunction: public RegExpTree { 1542 class RegExpDisjunction: public RegExpTree {
1544 public: 1543 public:
1545 explicit RegExpDisjunction(ZoneList<RegExpTree*>* alternatives); 1544 explicit RegExpDisjunction(ZoneList<RegExpTree*>* alternatives);
1546 virtual void* Accept(RegExpVisitor* visitor, void* data); 1545 virtual void* Accept(RegExpVisitor* visitor, void* data);
1547 virtual RegExpNode* ToNode(RegExpCompiler* compiler, 1546 virtual RegExpNode* ToNode(RegExpCompiler* compiler,
1548 RegExpNode* on_success); 1547 RegExpNode* on_success);
1549 virtual RegExpDisjunction* AsDisjunction(); 1548 virtual RegExpDisjunction* AsDisjunction();
1550 virtual Interval CaptureRegisters(); 1549 virtual Interval CaptureRegisters();
1551 virtual bool IsDisjunction(); 1550 virtual bool IsDisjunction();
1552 virtual bool IsAnchoredAtStart(); 1551 virtual bool IsAnchored();
1553 virtual bool IsAnchoredAtEnd();
1554 virtual int min_match() { return min_match_; } 1552 virtual int min_match() { return min_match_; }
1555 virtual int max_match() { return max_match_; } 1553 virtual int max_match() { return max_match_; }
1556 ZoneList<RegExpTree*>* alternatives() { return alternatives_; } 1554 ZoneList<RegExpTree*>* alternatives() { return alternatives_; }
1557 private: 1555 private:
1558 ZoneList<RegExpTree*>* alternatives_; 1556 ZoneList<RegExpTree*>* alternatives_;
1559 int min_match_; 1557 int min_match_;
1560 int max_match_; 1558 int max_match_;
1561 }; 1559 };
1562 1560
1563 1561
1564 class RegExpAlternative: public RegExpTree { 1562 class RegExpAlternative: public RegExpTree {
1565 public: 1563 public:
1566 explicit RegExpAlternative(ZoneList<RegExpTree*>* nodes); 1564 explicit RegExpAlternative(ZoneList<RegExpTree*>* nodes);
1567 virtual void* Accept(RegExpVisitor* visitor, void* data); 1565 virtual void* Accept(RegExpVisitor* visitor, void* data);
1568 virtual RegExpNode* ToNode(RegExpCompiler* compiler, 1566 virtual RegExpNode* ToNode(RegExpCompiler* compiler,
1569 RegExpNode* on_success); 1567 RegExpNode* on_success);
1570 virtual RegExpAlternative* AsAlternative(); 1568 virtual RegExpAlternative* AsAlternative();
1571 virtual Interval CaptureRegisters(); 1569 virtual Interval CaptureRegisters();
1572 virtual bool IsAlternative(); 1570 virtual bool IsAlternative();
1573 virtual bool IsAnchoredAtStart(); 1571 virtual bool IsAnchored();
1574 virtual bool IsAnchoredAtEnd();
1575 virtual int min_match() { return min_match_; } 1572 virtual int min_match() { return min_match_; }
1576 virtual int max_match() { return max_match_; } 1573 virtual int max_match() { return max_match_; }
1577 ZoneList<RegExpTree*>* nodes() { return nodes_; } 1574 ZoneList<RegExpTree*>* nodes() { return nodes_; }
1578 private: 1575 private:
1579 ZoneList<RegExpTree*>* nodes_; 1576 ZoneList<RegExpTree*>* nodes_;
1580 int min_match_; 1577 int min_match_;
1581 int max_match_; 1578 int max_match_;
1582 }; 1579 };
1583 1580
1584 1581
1585 class RegExpAssertion: public RegExpTree { 1582 class RegExpAssertion: public RegExpTree {
1586 public: 1583 public:
1587 enum Type { 1584 enum Type {
1588 START_OF_LINE, 1585 START_OF_LINE,
1589 START_OF_INPUT, 1586 START_OF_INPUT,
1590 END_OF_LINE, 1587 END_OF_LINE,
1591 END_OF_INPUT, 1588 END_OF_INPUT,
1592 BOUNDARY, 1589 BOUNDARY,
1593 NON_BOUNDARY 1590 NON_BOUNDARY
1594 }; 1591 };
1595 explicit RegExpAssertion(Type type) : type_(type) { } 1592 explicit RegExpAssertion(Type type) : type_(type) { }
1596 virtual void* Accept(RegExpVisitor* visitor, void* data); 1593 virtual void* Accept(RegExpVisitor* visitor, void* data);
1597 virtual RegExpNode* ToNode(RegExpCompiler* compiler, 1594 virtual RegExpNode* ToNode(RegExpCompiler* compiler,
1598 RegExpNode* on_success); 1595 RegExpNode* on_success);
1599 virtual RegExpAssertion* AsAssertion(); 1596 virtual RegExpAssertion* AsAssertion();
1600 virtual bool IsAssertion(); 1597 virtual bool IsAssertion();
1601 virtual bool IsAnchoredAtStart(); 1598 virtual bool IsAnchored();
1602 virtual bool IsAnchoredAtEnd();
1603 virtual int min_match() { return 0; } 1599 virtual int min_match() { return 0; }
1604 virtual int max_match() { return 0; } 1600 virtual int max_match() { return 0; }
1605 Type type() { return type_; } 1601 Type type() { return type_; }
1606 private: 1602 private:
1607 Type type_; 1603 Type type_;
1608 }; 1604 };
1609 1605
1610 1606
1611 class CharacterSet BASE_EMBEDDED { 1607 class CharacterSet BASE_EMBEDDED {
1612 public: 1608 public:
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
1765 explicit RegExpCapture(RegExpTree* body, int index) 1761 explicit RegExpCapture(RegExpTree* body, int index)
1766 : body_(body), index_(index) { } 1762 : body_(body), index_(index) { }
1767 virtual void* Accept(RegExpVisitor* visitor, void* data); 1763 virtual void* Accept(RegExpVisitor* visitor, void* data);
1768 virtual RegExpNode* ToNode(RegExpCompiler* compiler, 1764 virtual RegExpNode* ToNode(RegExpCompiler* compiler,
1769 RegExpNode* on_success); 1765 RegExpNode* on_success);
1770 static RegExpNode* ToNode(RegExpTree* body, 1766 static RegExpNode* ToNode(RegExpTree* body,
1771 int index, 1767 int index,
1772 RegExpCompiler* compiler, 1768 RegExpCompiler* compiler,
1773 RegExpNode* on_success); 1769 RegExpNode* on_success);
1774 virtual RegExpCapture* AsCapture(); 1770 virtual RegExpCapture* AsCapture();
1775 virtual bool IsAnchoredAtStart(); 1771 virtual bool IsAnchored();
1776 virtual bool IsAnchoredAtEnd();
1777 virtual Interval CaptureRegisters(); 1772 virtual Interval CaptureRegisters();
1778 virtual bool IsCapture(); 1773 virtual bool IsCapture();
1779 virtual int min_match() { return body_->min_match(); } 1774 virtual int min_match() { return body_->min_match(); }
1780 virtual int max_match() { return body_->max_match(); } 1775 virtual int max_match() { return body_->max_match(); }
1781 RegExpTree* body() { return body_; } 1776 RegExpTree* body() { return body_; }
1782 int index() { return index_; } 1777 int index() { return index_; }
1783 static int StartRegister(int index) { return index * 2; } 1778 static int StartRegister(int index) { return index * 2; }
1784 static int EndRegister(int index) { return index * 2 + 1; } 1779 static int EndRegister(int index) { return index * 2 + 1; }
1785 private: 1780 private:
1786 RegExpTree* body_; 1781 RegExpTree* body_;
(...skipping 11 matching lines...) Expand all
1798 is_positive_(is_positive), 1793 is_positive_(is_positive),
1799 capture_count_(capture_count), 1794 capture_count_(capture_count),
1800 capture_from_(capture_from) { } 1795 capture_from_(capture_from) { }
1801 1796
1802 virtual void* Accept(RegExpVisitor* visitor, void* data); 1797 virtual void* Accept(RegExpVisitor* visitor, void* data);
1803 virtual RegExpNode* ToNode(RegExpCompiler* compiler, 1798 virtual RegExpNode* ToNode(RegExpCompiler* compiler,
1804 RegExpNode* on_success); 1799 RegExpNode* on_success);
1805 virtual RegExpLookahead* AsLookahead(); 1800 virtual RegExpLookahead* AsLookahead();
1806 virtual Interval CaptureRegisters(); 1801 virtual Interval CaptureRegisters();
1807 virtual bool IsLookahead(); 1802 virtual bool IsLookahead();
1808 virtual bool IsAnchoredAtStart(); 1803 virtual bool IsAnchored();
1809 virtual int min_match() { return 0; } 1804 virtual int min_match() { return 0; }
1810 virtual int max_match() { return 0; } 1805 virtual int max_match() { return 0; }
1811 RegExpTree* body() { return body_; } 1806 RegExpTree* body() { return body_; }
1812 bool is_positive() { return is_positive_; } 1807 bool is_positive() { return is_positive_; }
1813 int capture_count() { return capture_count_; } 1808 int capture_count() { return capture_count_; }
1814 int capture_from() { return capture_from_; } 1809 int capture_from() { return capture_from_; }
1815 private: 1810 private:
1816 RegExpTree* body_; 1811 RegExpTree* body_;
1817 bool is_positive_; 1812 bool is_positive_;
1818 int capture_count_; 1813 int capture_count_;
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
1886 AST_NODE_LIST(DEF_VISIT) 1881 AST_NODE_LIST(DEF_VISIT)
1887 #undef DEF_VISIT 1882 #undef DEF_VISIT
1888 1883
1889 private: 1884 private:
1890 bool stack_overflow_; 1885 bool stack_overflow_;
1891 }; 1886 };
1892 1887
1893 } } // namespace v8::internal 1888 } } // namespace v8::internal
1894 1889
1895 #endif // V8_AST_H_ 1890 #endif // V8_AST_H_
OLDNEW
« no previous file with comments | « src/arm/regexp-macro-assembler-arm.cc ('k') | src/ast.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698