Skip to content

Commit

Permalink
fix: expand tmLanguage regexes for tuples and arrays
Browse files Browse the repository at this point in the history
The tuples and arrays were correctly parsed for individual types, but
the field regex didn't include possible token which made it fail to
include those types in them matching.
  • Loading branch information
dnaka91 committed Feb 2, 2024
1 parent 7737243 commit b589eac
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
7 changes: 6 additions & 1 deletion book/src/guide/examples/01.mabo
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
use other::schema::DateTime;

struct User {
first_name: string @1,
last_name: string @2,
birthday: DateTime @3,
gender: option<user::Gender> @4,
/// Latitude and longitude.
current_location: (f64, f64) @5,
/// Previous three locations.
///
/// Will be `(0.0, 0.0)` if there are less than three
/// history entries.
location_history: [(f64, f64); 3] @6,
}

mod user {
Expand All @@ -15,4 +21,3 @@ mod user {
NonBinary(string @1) @3,
}
}

2 changes: 1 addition & 1 deletion vscode-extension/syntaxes/mabo.tmLanguage.json
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@
"fieldNamed": {
"patterns": [
{
"match": "\\s*([a-zA-Z0-9_]+)\\s*(:)\\s*(&?[a-zA-Z0-9_]+(?:<.+>)?)\\s*(@\\d+)?(,)?",
"match": "\\s*([a-zA-Z0-9_]+)\\s*(:)\\s*(&?[a-zA-Z0-9_,;\\[\\]\\(\\)\\s]+(?:<.+>)?)\\s*(@\\d+)?(,)?",
"captures": {
"1": {
"name": "variable.language.mabo variable.other.mabo"
Expand Down
2 changes: 1 addition & 1 deletion vscode-extension/syntaxes/mabo.tmLanguage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ repository:
- include: "#fieldNamed"
fieldNamed:
patterns:
- match: \s*([a-zA-Z0-9_]+)\s*(:)\s*(&?[a-zA-Z0-9_]+(?:<.+>)?)\s*(@\d+)?(,)?
- match: \s*([a-zA-Z0-9_]+)\s*(:)\s*(&?[a-zA-Z0-9_,;\[\]\(\)\s]+(?:<.+>)?)\s*(@\d+)?(,)?
captures:
"1": { name: variable.language.mabo variable.other.mabo }
"2": { name: punctuation.colon.mabo }
Expand Down

0 comments on commit b589eac

Please sign in to comment.