OLD | NEW |
1 // This code was auto-generated, is not intended to be edited, and is subject to | 1 // This code was auto-generated, is not intended to be edited, and is subject to |
2 // significant change. Please see the README file for more information. | 2 // significant change. Please see the README file for more information. |
3 | 3 |
4 library engine.scanner; | 4 library engine.scanner; |
5 | 5 |
6 import 'dart:collection'; | 6 import 'dart:collection'; |
7 import 'java_core.dart'; | 7 import 'java_core.dart'; |
8 import 'java_engine.dart'; | 8 import 'java_engine.dart'; |
9 import 'source.dart'; | 9 import 'source.dart'; |
10 import 'error.dart'; | 10 import 'error.dart'; |
(...skipping 710 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
721 * The reader used to access the characters in the source. | 721 * The reader used to access the characters in the source. |
722 */ | 722 */ |
723 CharacterReader _reader; | 723 CharacterReader _reader; |
724 | 724 |
725 /** | 725 /** |
726 * The error listener that will be informed of any errors that are found durin
g the scan. | 726 * The error listener that will be informed of any errors that are found durin
g the scan. |
727 */ | 727 */ |
728 AnalysisErrorListener _errorListener; | 728 AnalysisErrorListener _errorListener; |
729 | 729 |
730 /** | 730 /** |
| 731 * The flag specifying if documentation comments should be parsed. |
| 732 */ |
| 733 bool _preserveComments = true; |
| 734 |
| 735 /** |
731 * The token pointing to the head of the linked list of tokens. | 736 * The token pointing to the head of the linked list of tokens. |
732 */ | 737 */ |
733 Token _tokens; | 738 Token _tokens; |
734 | 739 |
735 /** | 740 /** |
736 * The last token that was scanned. | 741 * The last token that was scanned. |
737 */ | 742 */ |
738 Token tail; | 743 Token tail; |
739 | 744 |
740 /** | 745 /** |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
799 List<int> get lineStarts => _lineStarts; | 804 List<int> get lineStarts => _lineStarts; |
800 | 805 |
801 /** | 806 /** |
802 * Return `true` if any unmatched groups were found during the parse. | 807 * Return `true` if any unmatched groups were found during the parse. |
803 * | 808 * |
804 * @return `true` if any unmatched groups were found during the parse | 809 * @return `true` if any unmatched groups were found during the parse |
805 */ | 810 */ |
806 bool hasUnmatchedGroups() => _hasUnmatchedGroups2; | 811 bool hasUnmatchedGroups() => _hasUnmatchedGroups2; |
807 | 812 |
808 /** | 813 /** |
| 814 * Set whether documentation tokens should be scanned. |
| 815 * |
| 816 * @param preserveComments `true` if documentation tokens should be scanned |
| 817 */ |
| 818 void set preserveComments(bool preserveComments) { |
| 819 this._preserveComments = preserveComments; |
| 820 } |
| 821 |
| 822 /** |
809 * Record that the source begins on the given line and column at the current o
ffset as given by | 823 * Record that the source begins on the given line and column at the current o
ffset as given by |
810 * the reader. The line starts for lines before the given line will not be cor
rect. | 824 * the reader. The line starts for lines before the given line will not be cor
rect. |
811 * | 825 * |
812 * This method must be invoked at most one time and must be invoked before sca
nning begins. The | 826 * This method must be invoked at most one time and must be invoked before sca
nning begins. The |
813 * values provided must be sensible. The results are undefined if these condit
ions are violated. | 827 * values provided must be sensible. The results are undefined if these condit
ions are violated. |
814 * | 828 * |
815 * @param line the one-based index of the line containing the first character
of the source | 829 * @param line the one-based index of the line containing the first character
of the source |
816 * @param column the one-based index of the column in which the first characte
r of the source | 830 * @param column the one-based index of the column in which the first characte
r of the source |
817 * occurs | 831 * occurs |
818 */ | 832 */ |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1023 token = new BeginTokenWithComment(type, _tokenStart, _firstComment); | 1037 token = new BeginTokenWithComment(type, _tokenStart, _firstComment); |
1024 _firstComment = null; | 1038 _firstComment = null; |
1025 _lastComment = null; | 1039 _lastComment = null; |
1026 } | 1040 } |
1027 tail = tail.setNext(token); | 1041 tail = tail.setNext(token); |
1028 _groupingStack.add(token); | 1042 _groupingStack.add(token); |
1029 _stackEnd++; | 1043 _stackEnd++; |
1030 } | 1044 } |
1031 | 1045 |
1032 void appendCommentToken(TokenType type, String value) { | 1046 void appendCommentToken(TokenType type, String value) { |
| 1047 if (!_preserveComments) { |
| 1048 return; |
| 1049 } |
1033 if (_firstComment == null) { | 1050 if (_firstComment == null) { |
1034 _firstComment = new StringToken(type, value, _tokenStart); | 1051 _firstComment = new StringToken(type, value, _tokenStart); |
1035 _lastComment = _firstComment; | 1052 _lastComment = _firstComment; |
1036 } else { | 1053 } else { |
1037 _lastComment = _lastComment.setNext(new StringToken(type, value, _tokenSta
rt)); | 1054 _lastComment = _lastComment.setNext(new StringToken(type, value, _tokenSta
rt)); |
1038 } | 1055 } |
1039 } | 1056 } |
1040 | 1057 |
1041 void appendEndToken(TokenType type, TokenType beginType) { | 1058 void appendEndToken(TokenType type, TokenType beginType) { |
1042 Token token; | 1059 Token token; |
(...skipping 1542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2585 * @return `true` if this token type represents an operator that can be define
d by users | 2602 * @return `true` if this token type represents an operator that can be define
d by users |
2586 */ | 2603 */ |
2587 bool get isUserDefinableOperator => identical(lexeme, "==") || identical(lexem
e, "~") || identical(lexeme, "[]") || identical(lexeme, "[]=") || identical(lexe
me, "*") || identical(lexeme, "/") || identical(lexeme, "%") || identical(lexeme
, "~/") || identical(lexeme, "+") || identical(lexeme, "-") || identical(lexeme,
"<<") || identical(lexeme, ">>") || identical(lexeme, ">=") || identical(lexeme
, ">") || identical(lexeme, "<=") || identical(lexeme, "<") || identical(lexeme,
"&") || identical(lexeme, "^") || identical(lexeme, "|"); | 2604 bool get isUserDefinableOperator => identical(lexeme, "==") || identical(lexem
e, "~") || identical(lexeme, "[]") || identical(lexeme, "[]=") || identical(lexe
me, "*") || identical(lexeme, "/") || identical(lexeme, "%") || identical(lexeme
, "~/") || identical(lexeme, "+") || identical(lexeme, "-") || identical(lexeme,
"<<") || identical(lexeme, ">>") || identical(lexeme, ">=") || identical(lexeme
, ">") || identical(lexeme, "<=") || identical(lexeme, "<") || identical(lexeme,
"&") || identical(lexeme, "^") || identical(lexeme, "|"); |
2588 } | 2605 } |
2589 | 2606 |
2590 class TokenType_EOF extends TokenType { | 2607 class TokenType_EOF extends TokenType { |
2591 TokenType_EOF(String name, int ordinal, TokenClass arg0, String arg1) : super.
con2(name, ordinal, arg0, arg1); | 2608 TokenType_EOF(String name, int ordinal, TokenClass arg0, String arg1) : super.
con2(name, ordinal, arg0, arg1); |
2592 | 2609 |
2593 String toString() => "-eof-"; | 2610 String toString() => "-eof-"; |
2594 } | 2611 } |
OLD | NEW |