Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change scope of new/delete Fix #64 #65

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 19 additions & 11 deletions generate.rb
Original file line number Diff line number Diff line change
Expand Up @@ -295,17 +295,25 @@
newPattern(
newPattern(
match: /delete/,
tag_as: "keyword.operator.memory.delete.array"
tag_as: "keyword.operator.delete.array"
).maybe(@spaces).then(
match: /\[\]/,
tag_as: "keyword.operator.memory.delete.array.bracket"
tag_as: "keyword.operator.delete.array.bracket"
)
).or(
newPattern(
match: /new/,
tag_as: "keyword.operator.new.array"
).maybe(@spaces).then(
match: /\[\]/,
tag_as: "keyword.operator.new.array.bracket"
)
).or(
match: /delete/,
tag_as: "keyword.operator.memory.delete"
tag_as: "keyword.operator.delete"
).or(
match: /new/,
tag_as: "keyword.operator.memory.new"
tag_as: "keyword.operator.new"
)
).lookAheadToAvoid(@standard_character)
)
Expand Down Expand Up @@ -869,9 +877,9 @@
#
# TODO: currently this is not used, ideally it will be built up over time and then be included
# it will be for things such as cout, cin, vector, string, map, etc
#
#
# Classes and structs
#
#
# the following are basically the equivlent of:
# @cpp_tokens.that(:isAccessSpecifier).or(/,/).or(/:/)
# that ^ causes an error in the lookBehindFor() so it has to be manually spread
Expand Down Expand Up @@ -938,15 +946,15 @@
),
tag_as: "meta.class-struct-block",
includes: [
#
#
# This part is only for what is before the {}'s (aka inhertance)
#
#
"#angle_brackets",
*inhertance_context,
#

#
# This Range is for everything in the {}'s
#
#
{
begin: "\\{",
beginCaptures: {
Expand Down
2 changes: 1 addition & 1 deletion syntaxes/cpp.tmLanguage.json

Large diffs are not rendered by default.

14 changes: 9 additions & 5 deletions syntaxes/cpp.tmLanguage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -379,16 +379,20 @@
- :match: "(?<!\\w)(asm|__asm__|enum|union|struct)(?!\\w)"
:name: storage.type.$0.cpp
memory_operators:
:match: "(?<!\\w)(?:(?:(delete)\\s*(\\[\\])|(delete))|(new))(?!\\w)"
:match: "(?<!\\w)(?:(?:(?:(delete)\\s*(\\[\\])|(new)\\s*(\\[\\]))|(delete))|(new))(?!\\w)"
:captures:
'1':
:name: keyword.operator.memory.delete.array.cpp
:name: keyword.operator.delete.array.cpp
'2':
:name: keyword.operator.memory.delete.array.bracket.cpp
:name: keyword.operator.delete.array.bracket.cpp
'3':
:name: keyword.operator.memory.delete.cpp
:name: keyword.operator.new.array.cpp
'4':
:name: keyword.operator.memory.new.cpp
:name: keyword.operator.new.array.bracket.cpp
'5':
:name: keyword.operator.delete.cpp
'6':
:name: keyword.operator.new.cpp
:name: keyword.operator.memory.cpp
template_call_innards:
:match: "<(?:[\\s<>,\\w])*>\\s*"
Expand Down