Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add some simple test cases for the protobuf language
This patch adds basic test cases for the protobuf language and fixes some whitespace issues. It also adds the missing requirement to the clike language to components.js.
- Loading branch information
1 parent
2746d7f
commit 3eec2b7
Showing
4 changed files
with
70 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
Prism.languages.protobuf = Prism.languages.extend('clike', { | ||
keyword: /\b(package|import|message|enum)\b/, | ||
builtin: /\b(required|repeated|optional|reserved)\b/, | ||
primitive: { | ||
pattern: /\b(double|float|int32|int64|uint32|uint64|sint32|sint64|fixed32|fixed64|sfixed32|sfixed64|bool|string|bytes)\b/, | ||
alias: 'symbol' | ||
} | ||
keyword: /\b(package|import|message|enum)\b/, | ||
builtin: /\b(required|repeated|optional|reserved)\b/, | ||
primitive: { | ||
pattern: /\b(double|float|int32|int64|uint32|uint64|sint32|sint64|fixed32|fixed64|sfixed32|sfixed64|bool|string|bytes)\b/, | ||
alias: 'symbol' | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
message Point { | ||
required int32 x = 1; | ||
required int32 y = 2; | ||
optional string label = 3; | ||
} | ||
|
||
---------------------------------------------------- | ||
|
||
[ | ||
["keyword", "message"], | ||
" Point ", | ||
["punctuation", "{"], | ||
|
||
["builtin", "required"], | ||
["primitive", "int32"], | ||
" x ", | ||
["operator", "="], | ||
["number", "1"], | ||
["punctuation", ";"], | ||
|
||
["builtin", "required"], | ||
["primitive", "int32"], | ||
" y ", | ||
["operator", "="], | ||
["number", "2"], | ||
["punctuation", ";"], | ||
|
||
["builtin", "optional"], | ||
["primitive", "string"], | ||
" label ", | ||
["operator", "="], | ||
["number", "3"], | ||
["punctuation", ";"], | ||
|
||
["punctuation", "}"] | ||
] | ||
|
||
---------------------------------------------------- | ||
|
||
Check for keywords and builtins |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
"" | ||
'' | ||
"foo" | ||
'foo' | ||
"'foo'" | ||
'"bar"' | ||
" // comment " | ||
|
||
---------------------------------------------------- | ||
|
||
[ | ||
["string", "\"\""], | ||
["string", "''"], | ||
["string", "\"foo\""], | ||
["string", "'foo'"], | ||
["string", "\"'foo'\""], | ||
["string", "'\"bar\"'"], | ||
["string", "\" // comment \""] | ||
] | ||
|
||
---------------------------------------------------- | ||
|
||
Checks for single-quoted and double-quoted strings. |