| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1707,7 +1707,7 @@ | |||
| 1707 | 1707 | ] | |
| 1708 | 1708 | } | |
| 1709 | 1709 | { | |
| 1710 | - 'begin': '(<<<)\\s*("?)(SQL)(\\2)(\\s*)$' | ||
| 1710 | + 'begin': '(<<<)\\s*("?)([DS]QL)(\\2)(\\s*)$' | ||
| 1711 | 1711 | 'beginCaptures': | |
| 1712 | 1712 | '0': | |
| 1713 | 1713 | 'name': 'punctuation.section.embedded.begin.php' | |
@@ -1985,7 +1985,7 @@ | |||
| 1985 | 1985 | ] | |
| 1986 | 1986 | } | |
| 1987 | 1987 | { | |
| 1988 | - 'begin': '(<<<)\\s*\'(SQL)\'(\\s*)$' | ||
| 1988 | + 'begin': '(<<<)\\s*\'([DS]QL)\'(\\s*)$' | ||
| 1989 | 1989 | 'beginCaptures': | |
| 1990 | 1990 | '0': | |
| 1991 | 1991 | 'name': 'punctuation.section.embedded.begin.php' | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -3450,6 +3450,74 @@ describe 'PHP grammar', -> | |||
| 3450 | 3450 | expect(lines[2][0]).toEqual value: 'SQL', scopes: ['source.php', 'string.unquoted.nowdoc.php', 'meta.embedded.sql', 'punctuation.section.embedded.end.php', 'keyword.operator.nowdoc.php'] | |
| 3451 | 3451 | expect(lines[2][1]).toEqual value: ';', scopes: ['source.php', 'punctuation.terminator.expression.php'] | |
| 3452 | 3452 | ||
| 3453 | + it 'should tokenize a heredoc with embedded DQL correctly', -> | ||
| 3454 | + waitsForPromise -> | ||
| 3455 | + atom.packages.activatePackage('language-sql') | ||
| 3456 | + | ||
| 3457 | + runs -> | ||
| 3458 | + lines = grammar.tokenizeLines ''' | ||
| 3459 | + $a = <<<DQL | ||
| 3460 | + SELECT * FROM table | ||
| 3461 | + DQL; | ||
| 3462 | + ''' | ||
| 3463 | + | ||
| 3464 | + expect(lines[0][0]).toEqual value: '$', scopes: ['source.php', 'variable.other.php', 'punctuation.definition.variable.php'] | ||
| 3465 | + expect(lines[0][1]).toEqual value: 'a', scopes: ['source.php', 'variable.other.php'] | ||
| 3466 | + expect(lines[0][2]).toEqual value: ' ', scopes: ['source.php'] | ||
| 3467 | + expect(lines[0][3]).toEqual value: '=', scopes: ['source.php', 'keyword.operator.assignment.php'] | ||
| 3468 | + expect(lines[0][4]).toEqual value: ' ', scopes: ['source.php'] | ||
| 3469 | + expect(lines[0][5]).toEqual value: '<<<', scopes: ['source.php', 'string.unquoted.heredoc.php', 'meta.embedded.sql', 'punctuation.section.embedded.begin.php', 'punctuation.definition.string.php'] | ||
| 3470 | + expect(lines[0][6]).toEqual value: 'DQL', scopes: ['source.php', 'string.unquoted.heredoc.php', 'meta.embedded.sql', 'punctuation.section.embedded.begin.php', 'keyword.operator.heredoc.php'] | ||
| 3471 | + expect(lines[1][0].value).toEqual 'SELECT' | ||
| 3472 | + expect(lines[1][0].scopes).toContainAll ['source.php', 'string.unquoted.heredoc.php', 'meta.embedded.sql', 'source.sql'] | ||
| 3473 | + expect(lines[1][1].value).toEqual ' ' | ||
| 3474 | + expect(lines[1][1].scopes).toContainAll ['source.php', 'string.unquoted.heredoc.php', 'meta.embedded.sql', 'source.sql'] | ||
| 3475 | + expect(lines[1][2].value).toEqual '*' | ||
| 3476 | + expect(lines[1][2].scopes).toContainAll ['source.php', 'string.unquoted.heredoc.php', 'meta.embedded.sql', 'source.sql'] | ||
| 3477 | + expect(lines[1][3].value).toEqual ' ' | ||
| 3478 | + expect(lines[1][3].scopes).toContainAll ['source.php', 'string.unquoted.heredoc.php', 'meta.embedded.sql', 'source.sql'] | ||
| 3479 | + expect(lines[1][4].value).toEqual 'FROM' | ||
| 3480 | + expect(lines[1][4].scopes).toContainAll ['source.php', 'string.unquoted.heredoc.php', 'meta.embedded.sql', 'source.sql'] | ||
| 3481 | + expect(lines[1][5].value).toEqual ' table' | ||
| 3482 | + expect(lines[1][5].scopes).toContainAll ['source.php', 'string.unquoted.heredoc.php', 'meta.embedded.sql', 'source.sql'] | ||
| 3483 | + expect(lines[2][0]).toEqual value: 'DQL', scopes: ['source.php', 'string.unquoted.heredoc.php', 'meta.embedded.sql', 'punctuation.section.embedded.end.php', 'keyword.operator.heredoc.php'] | ||
| 3484 | + expect(lines[2][1]).toEqual value: ';', scopes: ['source.php', 'punctuation.terminator.expression.php'] | ||
| 3485 | + | ||
| 3486 | + it 'should tokenize a nowdoc with embedded DQL correctly', -> | ||
| 3487 | + waitsForPromise -> | ||
| 3488 | + atom.packages.activatePackage('language-sql') | ||
| 3489 | + | ||
| 3490 | + runs -> | ||
| 3491 | + lines = grammar.tokenizeLines ''' | ||
| 3492 | + $a = <<<'DQL' | ||
| 3493 | + SELECT * FROM table | ||
| 3494 | + DQL; | ||
| 3495 | + ''' | ||
| 3496 | + | ||
| 3497 | + expect(lines[0][0]).toEqual value: '$', scopes: ['source.php', 'variable.other.php', 'punctuation.definition.variable.php'] | ||
| 3498 | + expect(lines[0][1]).toEqual value: 'a', scopes: ['source.php', 'variable.other.php'] | ||
| 3499 | + expect(lines[0][2]).toEqual value: ' ', scopes: ['source.php'] | ||
| 3500 | + expect(lines[0][3]).toEqual value: '=', scopes: ['source.php', 'keyword.operator.assignment.php'] | ||
| 3501 | + expect(lines[0][4]).toEqual value: ' ', scopes: ['source.php'] | ||
| 3502 | + expect(lines[0][5]).toEqual value: '<<<', scopes: ['source.php', 'string.unquoted.nowdoc.php', 'meta.embedded.sql', 'punctuation.section.embedded.begin.php', 'punctuation.definition.string.php'] | ||
| 3503 | + expect(lines[0][6]).toEqual value: '\'', scopes: ['source.php', 'string.unquoted.nowdoc.php', 'meta.embedded.sql', 'punctuation.section.embedded.begin.php'] | ||
| 3504 | + expect(lines[0][7]).toEqual value: 'DQL', scopes: ['source.php', 'string.unquoted.nowdoc.php', 'meta.embedded.sql', 'punctuation.section.embedded.begin.php', 'keyword.operator.nowdoc.php'] | ||
| 3505 | + expect(lines[0][8]).toEqual value: '\'', scopes: ['source.php', 'string.unquoted.nowdoc.php', 'meta.embedded.sql', 'punctuation.section.embedded.begin.php'] | ||
| 3506 | + expect(lines[1][0].value).toEqual 'SELECT' | ||
| 3507 | + expect(lines[1][0].scopes).toContainAll ['source.php', 'string.unquoted.nowdoc.php', 'meta.embedded.sql', 'source.sql'] | ||
| 3508 | + expect(lines[1][1].value).toEqual ' ' | ||
| 3509 | + expect(lines[1][1].scopes).toContainAll ['source.php', 'string.unquoted.nowdoc.php', 'meta.embedded.sql', 'source.sql'] | ||
| 3510 | + expect(lines[1][2].value).toEqual '*' | ||
| 3511 | + expect(lines[1][2].scopes).toContainAll ['source.php', 'string.unquoted.nowdoc.php', 'meta.embedded.sql', 'source.sql'] | ||
| 3512 | + expect(lines[1][3].value).toEqual ' ' | ||
| 3513 | + expect(lines[1][3].scopes).toContainAll ['source.php', 'string.unquoted.nowdoc.php', 'meta.embedded.sql', 'source.sql'] | ||
| 3514 | + expect(lines[1][4].value).toEqual 'FROM' | ||
| 3515 | + expect(lines[1][4].scopes).toContainAll ['source.php', 'string.unquoted.nowdoc.php', 'meta.embedded.sql', 'source.sql'] | ||
| 3516 | + expect(lines[1][5].value).toEqual ' table' | ||
| 3517 | + expect(lines[1][5].scopes).toContainAll ['source.php', 'string.unquoted.nowdoc.php', 'meta.embedded.sql', 'source.sql'] | ||
| 3518 | + expect(lines[2][0]).toEqual value: 'DQL', scopes: ['source.php', 'string.unquoted.nowdoc.php', 'meta.embedded.sql', 'punctuation.section.embedded.end.php', 'keyword.operator.nowdoc.php'] | ||
| 3519 | + expect(lines[2][1]).toEqual value: ';', scopes: ['source.php', 'punctuation.terminator.expression.php'] | ||
| 3520 | + | ||
| 3453 | 3521 | it 'should tokenize a heredoc with embedded javascript correctly', -> | |
| 3454 | 3522 | waitsForPromise -> | |
| 3455 | 3523 | atom.packages.activatePackage('language-javascript') | |
| Back | FazBrowse Home | New Git URL |
0 commit comments