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

Add support for impl and constraint declaration in Carbon lexer #2368

Merged
merged 1 commit into from
Mar 2, 2023
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion pygments/lexers/carbon.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class CarbonLexer(RegexLexer):
# Declaration
(r'(package|import|api|namespace|library)\b', Keyword.Namespace),
(r'(abstract|alias|fn|class|interface|let|var|virtual|external|'
r'base|addr|extends|choice)\b', Keyword.Declaration),
r'base|addr|extends|choice|constraint|impl)\b', Keyword.Declaration),
# Keywords
(words(('as', 'or', 'not', 'and', 'break', 'continue', 'case',
'default', 'if', 'else', 'destructor', 'for', 'forall',
Expand Down
9 changes: 8 additions & 1 deletion tests/examplefiles/carbon/declarations.carbon
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,11 @@ class Pal {

abstract class MyAbstractClass {
protected fn Create() -> partial Self { }
}
}

constraint DrawVectorLegoFish {
impl as VectorLegoFish;
impl as Drawable;
}

impl JustX as X {}
44 changes: 44 additions & 0 deletions tests/examplefiles/carbon/declarations.carbon.output

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.