Skip to content

Commit

Permalink
fix #647
Browse files Browse the repository at this point in the history
  • Loading branch information
jeff-hykin committed Jul 5, 2024
1 parent ef8b22c commit be00901
Show file tree
Hide file tree
Showing 6 changed files with 179 additions and 64 deletions.
2 changes: 1 addition & 1 deletion autogenerated/cpp.embedded.macro.tmLanguage.json

Large diffs are not rendered by default.

122 changes: 61 additions & 61 deletions autogenerated/cpp.tmLanguage.json

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions language_examples/#647.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
using some_space::operator<<;

int main() {
std::cout << operator<<(std::cout, "Hello, world!");
}
104 changes: 104 additions & 0 deletions language_examples/#647.spec.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
- source: using
scopes:
- keyword.other.using.directive
- source: some_space
scopesBegin:
- meta.function.definition.special.operator-overload
scopes:
- entity.name.scope-resolution.operator
- source: '::'
scopes:
- punctuation.separator.namespace.access
- punctuation.separator.scope-resolution.operator
- source: operator
scopesBegin:
- meta.head.function.definition.special.operator-overload
scopes:
- keyword.other.operator.overload
- source: '<<'
scopes:
- entity.name.operator
scopesEnd:
- meta.function.definition.special.operator-overload
- meta.head.function.definition.special.operator-overload
- source: ;
scopes:
- punctuation.terminator.statement
- source: int
scopesBegin:
- meta.function.definition
scopes:
- meta.qualified_type
- storage.type.primitive
- storage.type.built-in.primitive
- source: main
scopesBegin:
- meta.head.function.definition
scopes:
- entity.name.function.definition
- source: (
scopes:
- punctuation.section.parameters.begin.bracket.round
- source: )
scopes:
- punctuation.section.parameters.end.bracket.round
- source: '{'
scopes:
- punctuation.section.block.begin.bracket.curly.function.definition
scopesEnd:
- meta.head.function.definition
- source: std
scopesBegin:
- meta.body.function.definition
scopes:
- entity.name.scope-resolution
- source: '::'
scopes:
- punctuation.separator.namespace.access
- punctuation.separator.scope-resolution
- source: 'cout '
- source: '<<'
scopes:
- keyword.operator.bitwise.shift
- source: ' operator'
- source: '<<'
scopes:
- keyword.operator.bitwise.shift
- source: (
scopesBegin:
- meta.parens
scopes:
- punctuation.section.parens.begin.bracket.round
- source: std
scopes:
- entity.name.scope-resolution
- source: '::'
scopes:
- punctuation.separator.namespace.access
- punctuation.separator.scope-resolution
- source: cout
- source: ','
scopes:
- punctuation.separator.delimiter.comma
- source: '"'
scopesBegin:
- string.quoted.double
scopes:
- punctuation.definition.string.begin
- source: 'Hello, world!'
- source: '"'
scopes:
- punctuation.definition.string.end
scopesEnd:
- string.quoted.double
- source: )
scopes:
- punctuation.section.parens.end.bracket.round
scopesEnd:
- meta.parens
- source: ;
scopes:
- punctuation.terminator.statement
- source: '}'
scopes:
- punctuation.section.block.end.bracket.curly.function.definition
2 changes: 1 addition & 1 deletion main/main.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1296,7 +1296,7 @@ def generateBlockFinder( name:"", tag_as:"", start_pattern:nil, needs_semicolon:
)
)
# lookahead for the start of a template type or the start of the function parameters
).then(std_space).lookAheadFor(/\<|\(/)
).then(std_space).lookAheadFor(/;|\<|\(/)
),
head_includes:[
:ever_present_context, # comments and macros
Expand Down
8 changes: 7 additions & 1 deletion main/textmate_tools.rb
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,13 @@ def lookAheadToAvoidWordsThat(*adjectives)
end

def that(*adjectives)
return oneOf(representationsThat(*adjectives))
representations = representationsThat(*adjectives)
regex_internals = representations.map do |each|
Regexp.escape(each)
end.join('|')
return Pattern.new(/(?:#{regex_internals})/)
# oneOf has problems (as of 2024-07)
# return oneOf(representationsThat(*adjectives))
end
end

Expand Down

0 comments on commit be00901

Please sign in to comment.