mirror of
https://github.com/atom/atom.git
synced 2026-01-23 13:58:08 -05:00
Merge branch 'master' into atom-shell
This commit is contained in:
@@ -597,3 +597,20 @@ describe "TextMateGrammar", ->
|
||||
tokens = lines[1]
|
||||
expect(tokens[2].value).toBe '@"'
|
||||
expect(tokens[2].scopes).toEqual ["source.objc++", "meta.function.c", "meta.block.c", "string.quoted.double.objc", "punctuation.definition.string.begin.objc"]
|
||||
|
||||
describe "Java", ->
|
||||
beforeEach ->
|
||||
atom.activatePackage('java-tmbundle', sync: true)
|
||||
grammar = syntax.selectGrammar('Function.java')
|
||||
lines = grammar.tokenizeLines """
|
||||
public void test() {
|
||||
//comment
|
||||
}
|
||||
"""
|
||||
|
||||
it "correctly parses single line comments", ->
|
||||
tokens = lines[1]
|
||||
expect(tokens[0].scopes).toEqual ["source.java", "comment.line.double-slash.java", "punctuation.definition.comment.java"]
|
||||
expect(tokens[0].value).toEqual '//'
|
||||
expect(tokens[1].scopes).toEqual ["source.java", "comment.line.double-slash.java"]
|
||||
expect(tokens[1].value).toEqual 'comment'
|
||||
|
||||
@@ -159,7 +159,7 @@ class TextMateGrammar
|
||||
ruleStack.pop()
|
||||
|
||||
[penultimateRule, lastRule] = ruleStack[-2..]
|
||||
if lastRule? and penultimateRule.scopeName == lastRule.scopeName
|
||||
if lastRule?.scopeName? and penultimateRule.scopeName == lastRule.scopeName
|
||||
ruleStack.pop()
|
||||
tokens.push(new Token(
|
||||
value: line[position...line.length]
|
||||
@@ -203,7 +203,7 @@ class Injections
|
||||
return injection.scanner if injection.scanner?
|
||||
|
||||
regexes = _.map injection.patterns, (pattern) ->
|
||||
pattern.getRegex(firstLine, position, @anchorPosition)
|
||||
pattern.getRegex(firstLine, position, anchorPosition)
|
||||
scanner = new OnigScanner(regexes)
|
||||
scanner.patterns = injection.patterns
|
||||
scanner.anchored = injection.anchored
|
||||
|
||||
Reference in New Issue
Block a user