| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "tools/gn/parser.h" | 5 #include "tools/gn/parser.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "tools/gn/functions.h" | 8 #include "tools/gn/functions.h" |
| 9 #include "tools/gn/operators.h" | 9 #include "tools/gn/operators.h" |
| 10 #include "tools/gn/token.h" | 10 #include "tools/gn/token.h" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 "\n" | 49 "\n" |
| 50 " integer = [ \"-\" ] digit { digit } .\n" | 50 " integer = [ \"-\" ] digit { digit } .\n" |
| 51 "\n" | 51 "\n" |
| 52 " Leading zeros and negative zero are disallowed.\n" | 52 " Leading zeros and negative zero are disallowed.\n" |
| 53 "\n" | 53 "\n" |
| 54 "String literals\n" | 54 "String literals\n" |
| 55 "\n" | 55 "\n" |
| 56 " A string literal represents a string value consisting of the quoted\n" | 56 " A string literal represents a string value consisting of the quoted\n" |
| 57 " characters with possible escape sequences and variable expansions.\n" | 57 " characters with possible escape sequences and variable expansions.\n" |
| 58 "\n" | 58 "\n" |
| 59 " string = `\"` { char | escape | expansion } `\"` .\n" | 59 " string = `\"` { char | escape | expansion } `\"` .\n" |
| 60 " escape = `\\` ( \"$\" | `\"` | char ) .\n" | 60 " escape = `\\` ( \"$\" | `\"` | char ) .\n" |
| 61 " expansion = \"$\" ( identifier | \"{\" identifier \"}\" ) .\n" | 61 " BracketExpansion = \"{\" ( identifier | ArrayAccess | ScopeAccess " |
| 62 " char = /* any character except \"$\", `\"`, or newline */ .\n" | 62 ") \"}\" .\n" |
| 63 " expansion = \"$\" ( identifier | BracketExpansion ) .\n" |
| 64 " char = /* any character except \"$\", `\"`, or newline " |
| 65 "*/ .\n" |
| 63 "\n" | 66 "\n" |
| 64 " After a backslash, certain sequences represent special characters:\n" | 67 " After a backslash, certain sequences represent special characters:\n" |
| 65 "\n" | 68 "\n" |
| 66 " \\\" U+0022 quotation mark\n" | 69 " \\\" U+0022 quotation mark\n" |
| 67 " \\$ U+0024 dollar sign\n" | 70 " \\$ U+0024 dollar sign\n" |
| 68 " \\\\ U+005C backslash\n" | 71 " \\\\ U+005C backslash\n" |
| 69 "\n" | 72 "\n" |
| 70 " All other backslashes represent themselves.\n" | 73 " All other backslashes represent themselves.\n" |
| 71 "\n" | 74 "\n" |
| 72 "Punctuation\n" | 75 "Punctuation\n" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 85 " File = StatementList .\n" | 88 " File = StatementList .\n" |
| 86 "\n" | 89 "\n" |
| 87 " Statement = Assignment | Call | Condition .\n" | 90 " Statement = Assignment | Call | Condition .\n" |
| 88 " Assignment = identifier AssignOp Expr .\n" | 91 " Assignment = identifier AssignOp Expr .\n" |
| 89 " Call = identifier \"(\" [ ExprList ] \")\" [ Block ] .\n" | 92 " Call = identifier \"(\" [ ExprList ] \")\" [ Block ] .\n" |
| 90 " Condition = \"if\" \"(\" Expr \")\" Block\n" | 93 " Condition = \"if\" \"(\" Expr \")\" Block\n" |
| 91 " [ \"else\" ( Condition | Block ) ] .\n" | 94 " [ \"else\" ( Condition | Block ) ] .\n" |
| 92 " Block = \"{\" StatementList \"}\" .\n" | 95 " Block = \"{\" StatementList \"}\" .\n" |
| 93 " StatementList = { Statement } .\n" | 96 " StatementList = { Statement } .\n" |
| 94 "\n" | 97 "\n" |
| 98 " ArrayAccess = identifier \"[\" { identifier | integer } \"]\" .\n" |
| 99 " ScopeAccess = identifier \".\" identifier .\n" |
| 95 " Expr = UnaryExpr | Expr BinaryOp Expr .\n" | 100 " Expr = UnaryExpr | Expr BinaryOp Expr .\n" |
| 96 " UnaryExpr = PrimaryExpr | UnaryOp UnaryExpr .\n" | 101 " UnaryExpr = PrimaryExpr | UnaryOp UnaryExpr .\n" |
| 97 " PrimaryExpr = identifier | integer | string | Call\n" | 102 " PrimaryExpr = identifier | integer | string | Call\n" |
| 98 " | identifier \"[\" Expr \"]\"\n" | 103 " | ArrayAccess | ScopeAccess\n" |
| 99 " | identifier \".\" identifier\n" | |
| 100 " | \"(\" Expr \")\"\n" | 104 " | \"(\" Expr \")\"\n" |
| 101 " | \"[\" [ ExprList [ \",\" ] ] \"]\" .\n" | 105 " | \"[\" [ ExprList [ \",\" ] ] \"]\" .\n" |
| 102 " ExprList = Expr { \",\" Expr } .\n" | 106 " ExprList = Expr { \",\" Expr } .\n" |
| 103 "\n" | 107 "\n" |
| 104 " AssignOp = \"=\" | \"+=\" | \"-=\" .\n" | 108 " AssignOp = \"=\" | \"+=\" | \"-=\" .\n" |
| 105 " UnaryOp = \"!\" .\n" | 109 " UnaryOp = \"!\" .\n" |
| 106 " BinaryOp = \"+\" | \"-\" // highest priority\n" | 110 " BinaryOp = \"+\" | \"-\" // highest priority\n" |
| 107 " | \"<\" | \"<=\" | \">\" | \">=\"\n" | 111 " | \"<\" | \"<=\" | \">\" | \">=\"\n" |
| 108 " | \"==\" | \"!=\"\n" | 112 " | \"==\" | \"!=\"\n" |
| 109 " | \"&&\"\n" | 113 " | \"&&\"\n" |
| (...skipping 627 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 737 break; | 741 break; |
| 738 } | 742 } |
| 739 } | 743 } |
| 740 | 744 |
| 741 // Suffix comments were assigned in reverse, so if there were multiple on | 745 // Suffix comments were assigned in reverse, so if there were multiple on |
| 742 // the same node, they need to be reversed. | 746 // the same node, they need to be reversed. |
| 743 if ((*i)->comments() && !(*i)->comments()->suffix().empty()) | 747 if ((*i)->comments() && !(*i)->comments()->suffix().empty()) |
| 744 const_cast<ParseNode*>(*i)->comments_mutable()->ReverseSuffix(); | 748 const_cast<ParseNode*>(*i)->comments_mutable()->ReverseSuffix(); |
| 745 } | 749 } |
| 746 } | 750 } |
| OLD | NEW |