Skip to content

Commit

Permalink
merge with Fix-#108
Browse files Browse the repository at this point in the history
  • Loading branch information
jeff-hykin committed Apr 22, 2019
2 parents 50f7fee + c75d437 commit 77dfa6a
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 40 deletions.
7 changes: 7 additions & 0 deletions c/debug.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
require_relative 'generate.rb'
# this will overwrite the system syntax with the generated syntax
if (/darwin/ =~ RUBY_PLATFORM) != nil
`cp '#{@syntax_location}.json' '/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/cpp/syntaxes'`
else
puts "\n\nCurrently the build command is only has support for Mac"
end
53 changes: 22 additions & 31 deletions c/generate.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@
c_grammar.data[:repository] = @cpp_grammar.data[:repository]
else

#
# Contexts
#
evalutation_context = [
"#function-call-innards",
"$base"
]

#
# Variable
#
Expand Down Expand Up @@ -807,35 +815,17 @@
match: "%|\\*|/|-|\\+",
name: "keyword.operator.c"
},
{
begin: "\\?",
beginCaptures: {
"0" => {
name: "keyword.operator.ternary.c"
}
},
end: ":",
applyEndPatternLast: true,
endCaptures: {
"0" => {
name: "keyword.operator.ternary.c"
}
},
patterns: [
{
include: "#method_access"
},
{
include: "#member_access"
},
{
include: "#c_function_call"
},
{
include: "$base"
}
]
}
Range.new(
start_pattern: newPattern(
match: /\?/,
tag_as: "keyword.operator.ternary",
),
end_pattern: newPattern(
match: /:/,
tag_as: "keyword.operator.ternary",
),
includes: [ *evalutation_context ]
).to_tag,
]
},
"strings" => {
Expand Down Expand Up @@ -2161,5 +2151,6 @@
Dir.chdir __dir__

# Save
c_grammar.saveAsYamlTo("../syntaxes/c.tmLanguage")
c_grammar.saveAsJsonTo("../syntaxes/c.tmLanguage")
@syntax_location = "../syntaxes/c.tmLanguage"
c_grammar.saveAsYamlTo(@syntax_location)
c_grammar.saveAsJsonTo(@syntax_location)
2 changes: 1 addition & 1 deletion syntaxes/c.tmLanguage.json

Large diffs are not rendered by default.

13 changes: 5 additions & 8 deletions syntaxes/c.tmLanguage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -475,19 +475,16 @@
name: keyword.operator.assignment.c
- match: "%|\\*|/|-|\\+"
name: keyword.operator.c
- begin: "\\?"
- begin: "(\\?)"
beginCaptures:
'0':
'1':
name: keyword.operator.ternary.c
end: ":"
applyEndPatternLast: true
end: "(:)"
endCaptures:
'0':
'1':
name: keyword.operator.ternary.c
patterns:
- include: "#method_access"
- include: "#member_access"
- include: "#c_function_call"
- include: "#function-call-innards"
- include: "$base"
strings:
patterns:
Expand Down

0 comments on commit 77dfa6a

Please sign in to comment.