|
9 | 9 | type associativity int
|
10 | 10 |
|
11 | 11 | const (
|
12 |
| - left associativity = iota + 1 |
| 12 | + left associativity = iota + 1 |
13 | 13 | right
|
14 | 14 | )
|
15 | 15 |
|
@@ -415,19 +415,19 @@ func (p *parser) parsePostfixExpression(node Node) (Node, error) {
|
415 | 415 | }
|
416 | 416 |
|
417 | 417 | if token.kind != name &&
|
418 |
| - // Operators like "not" and "matches" are valid method or property names, |
419 |
| - // |
420 |
| - // In other words, besides name token kind, operator kind could also be parsed as a property or method. |
421 |
| - // This is because operators are processed by the lexer prior to names. So "not" in "foo.not()" |
422 |
| - // or "matches" in "foo.matches" will be recognized as an operator first. But in fact, "not" |
423 |
| - // and "matches" in such expressions shall be parsed as method or property names. |
424 |
| - // |
425 |
| - // And this ONLY works if the operator consists of valid characters for a property or method name. |
426 |
| - // |
427 |
| - // Other types, such as text kind and number kind, can't be parsed as property nor method names. |
428 |
| - // |
429 |
| - // As a result, if token is NOT an operator OR token.value is NOT a valid property or method name, |
430 |
| - // an error shall be returned. |
| 418 | + // Operators like "not" and "matches" are valid method or property names, |
| 419 | + // |
| 420 | + // In other words, besides name token kind, operator kind could also be parsed as a property or method. |
| 421 | + // This is because operators are processed by the lexer prior to names. So "not" in "foo.not()" |
| 422 | + // or "matches" in "foo.matches" will be recognized as an operator first. But in fact, "not" |
| 423 | + // and "matches" in such expressions shall be parsed as method or property names. |
| 424 | + // |
| 425 | + // And this ONLY works if the operator consists of valid characters for a property or method name. |
| 426 | + // |
| 427 | + // Other types, such as text kind and number kind, can't be parsed as property nor method names. |
| 428 | + // |
| 429 | + // As a result, if token is NOT an operator OR token.value is NOT a valid property or method name, |
| 430 | + // an error shall be returned. |
431 | 431 | (token.kind != operator || !isValidIdentifier(token.value)) {
|
432 | 432 | return nil, p.errorf("expected name")
|
433 | 433 | }
|
|
0 commit comments