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

coq.tmLanguage: update from vscoq upstream, convert to json #105

Merged
merged 2 commits into from
Dec 19, 2022
Merged
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
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
- Use plugin include paths from `_CoqProject` (@ejgallego, #88)
- Support OCaml >= 4.12 (@ejgallego, #93)
- Optimize the number of diagnostics sent in eager mode (@ejgallego, #104)
- Improved syntax highlighting (@artagnon, #105)

# coq-lsp 0.1.0: Memory
-----------------------
Expand Down
2 changes: 1 addition & 1 deletion editor/code/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
{
"language": "coq",
"scopeName": "source.coq",
"path": "./syntaxes/coq.tmLanguage"
"path": "./syntaxes/coq.json"
}
],
"commands": [
Expand Down
229 changes: 229 additions & 0 deletions editor/code/syntaxes/coq.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,229 @@
{
"fileTypes": ["v"],
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be great if we could have some of this working for .mv files too, but I'm unsure how.

Note that we could also use LSP semantic highlighting.

"name": "Coq",
"patterns": [
{
"match": "\\b(From|Require|Import|Export|Local|Global|Include)\\b",
"comment": "Vernacular import keywords",
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically Global and Local are import modifiers and not "Import Keywords" as Require or Import are; for example you have Global Variable etc...

"name": "keyword.control.import.coq"
},
{
"match": "\\b((Open|Close|Delimit|Undelimit|Bind)\\s+Scope)\\b",
"comment": "Vernacular scope keywords",
"name": "keyword.control.import.coq"
},
{
"match": "(Theorem|Lemma|Remark|Fact|Corollary|Property|Proposition|Goal)\\s+((\\p{L}|[_\\u00A0])(\\p{L}|[0-9_\\u00A0'])*)",
"comment": "Theorem declarations",
"captures": {
"1": {
"name": "keyword.source.coq"
},
"2": {
"name": "entity.name.function.theorem.coq"
}
}
},
{
"match": "\\b(Parameters?|Axioms?|Conjectures?|Variables?|Hypothesis|Hypotheses)(\\s+Inline)?\\b\\s*\\(?\\s*((\\p{L}|[_\\u00A0])(\\p{L}|[0-9_\\u00A0'])*)",
"comment": "Assumptions",
"captures": {
"1": {
"name": "keyword.source.coq"
},
"2": {
"name": "keyword.source.coq"
},
"3": {
"name": "entity.name.assumption.coq"
}
}
},
{
"match": "\\b(Context)\\b\\s*`?\\s*(\\(|\\{)?\\s*((\\p{L}|[_\\u00A0])(\\p{L}|[0-9_\\u00A0'])*)",
"comment": "Context",
"captures": {
"1": {
"name": "keyword.source.coq"
},
"3": {
"name": "entity.name.assumption.coq"
}
}
},
{
"match": "(\\b(?:Program|Local)\\s+)?\\b(Definition|Fixpoint|CoFixpoint|Function|Example|Let(?:\\s+Fixpoint|\\s+CoFixpoint)?|Instance)\\s+((\\p{L}|[_\\u00A0])(\\p{L}|[0-9_\\u00A0'])*)",
"comment": "Definitions",
"captures": {
"1": {
"name": "keyword.source.coq"
},
"2": {
"name": "keyword.source.coq"
},
"3": {
"name": "entity.name.function.coq"
}
}
},
{
"match": "\\b((Show\\s+)?Obligation\\s+Tactic|Obligations\\s+of|Obligation|Next\\s+Obligation(\\s+of)?|Solve\\s+Obligations(\\s+of)?|Solve\\s+All\\s+Obligations|Admit\\s+Obligations(\\s+of)?|Instance)\\b",
"comment": "Obligations",
"captures": {
"1": {
"name": "keyword.source.coq"
}
}
},
{
"match": "(CoInductive|Inductive|Variant|Record|Structure|Class)\\s+(>\\s*)?((\\p{L}|[_\\u00A0])(\\p{L}|[0-9_\\u00A0'])*)",
"comment": "Type declarations",
"captures": {
"1": {
"name": "keyword.source.coq"
},
"3": {
"name": "entity.name.type.coq"
}
}
},
{
"match": "(Ltac)\\s+((\\p{L}|[_\\u00A0])(\\p{L}|[0-9_\\u00A0'])*)",
"comment": "Ltac declarations",
"captures": {
"1": {
"name": "keyword.source.coq"
},
"2": {
"name": "entity.name.function.ltac"
}
}
},
{
"match": "\\b(Hint|Constructors|Resolve|Rewrite|Ltac|Implicit(\\s+Types)?|Set|Unset|Remove\\s+Printing|Arguments|Tactic\\s+Notation|Notation|Infix|Reserved\\s+Notation|Section|Module\\s+Type|Module|End|Check|Print|Eval|Search|Universe|Coercions?|Generalizable\\s+All|Generalizable\\s+Variable?|Existing\\s+Instance|Existing\\s+Class|Canonical|About|Locate|Collection|Typeclasses\\s+(Opaque|Transparent))\\b",
"comment": "Vernacular keywords",
"name": "keyword.source.coq"
},
{
"match": "\\b(Proof|Qed|Defined|Save|Abort(\\s+All)?|Undo(\\s+To)?|Restart|Focus|Unfocus|Unfocused|Show\\s+Proof|Show\\s+Existentials|Show|Unshelve)\\b",
"comment": "Proof keywords",
"name": "keyword.source.coq"
},
{
"match": "\\b(Quit|Drop|Time|Redirect|Timeout|Fail)\\b",
"comment": "Vernacular Debug keywords",
"name": "keyword.debug.coq"
},
{
"match": "\\b(admit|Admitted)\\b",
"comment": "Admits are bad",
"name": "invalid.illegal.admit.coq"
},
{
"match": ":|\\||=|<|>|\\*|\\+|-|\\{|\\}|≠|∨|∧|↔|¬|→|≤|≥",
"comment": "Operators",
"name": "keyword.operator.coq"
},
{
"match": "\\b(forall|exists|Type|Set|Prop|nat|bool|option|list|unit|sum|prod|comparison|Empty_set)\\b|∀|∃",
"comment": "Type keywords",
"name": "support.type.coq"
},
{
"match": "\\b(try|repeat|rew|progress|fresh|solve|now|first|tryif|at|once|do|only)\\b",
"comment": "Ltac keywords",
"name": "keyword.control.ltac"
},
{
"match": "\\b(into|with|eqn|by|move|as|using)\\b",
"comment": "Common Ltac connectors",
"name": "keyword.control.ltac"
},
{
"match": "\\b(match|lazymatch|multimatch|fun|with|return|end|let|in|if|then|else|fix|for|where|and)\\b|λ",
"comment": "Gallina keywords",
"name": "keyword.control.gallina"
},
{
"match": "\\b(intro|intros|revert|induction|destruct|auto|eauto|tauto|eassumption|apply|eapply|assumption|constructor|econstructor|reflexivity|inversion|injection|assert|split|esplit|omega|fold|unfold|specialize|rewrite|erewrite|change|symmetry|refine|simpl|intuition|firstorder|generalize|idtac|exist|exists|eexists|elim|eelim|rename|subst|congruence|trivial|left|right|set|pose|discriminate|clear|clearbody|contradict|contradiction|exact|dependent|remember|case|easy|unshelve|pattern|transitivity|etransitivity|f_equal|exfalso|replace|abstract|cycle|swap|revgoals|shelve|unshelve)\\b",
"comment": "Ltac builtins",
"name": "support.function.builtin.ltac"
},
{
"applyEndPatternLast": 1,
"begin": "\\(\\*(?!#)",
"end": "\\*\\)",
"name": "comment.block.coq",
"patterns": [
{
"include": "#block_comment"
},
{
"include": "#block_double_quoted_string"
}
]
},
{
"match": "\\b((0(x|X)[0-9a-fA-F]+)|([0-9]+(\\.[0-9]+)?))\\b",
"name": "constant.numeric.gallina"
},
{
"match": "\\b(True|False|tt|false|true|Some|None|nil|cons|pair|inl|inr|O|S|Eq|Lt|Gt|id|ex|all|unique)\\b",
"comment": "Gallina builtin constructors",
"name": "constant.language.constructor.gallina"
},
{
"match": "\\b_\\b",
"name": "constant.language.wildcard.coq"
},
{
"begin": "\"",
"beginCaptures": {
"0": {
"name": "punctuation.definition.string.begin.coq"
}
},
"end": "\"",
"endCaptures": {
"0": {
"name": "punctuation.definition.string.end.coq"
}
},
"name": "string.quoted.double.coq"
}
],
"repository": {
"block_comment": {
"applyEndPatternLast": 1,
"begin": "\\(\\*(?!#)",
"end": "\\*\\)",
"name": "comment.block.coq",
"patterns": [
{
"include": "#block_comment"
},
{
"include": "#block_double_quoted_string"
}
]
},
"block_double_quoted_string": {
"applyEndPatternLast": 1,
"begin": "\"",
"beginCaptures": {
"0": {
"name": "punctuation.definition.string.begin.coq"
}
},
"end": "\"",
"endCaptures": {
"0": {
"name": "punctuation.definition.string.end.coq"
}
},
"name": "string.quoted.double.coq"
}
},
"scopeName": "source.coq",
"uuid": "CDE1AD3A-C094-457D-B321-93009C6BCFDA"
}
Loading