-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement some handling of preprocessor macros
- Loading branch information
Showing
4 changed files
with
114 additions
and
1 deletion.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,47 @@ | ||
# Preprocessor macros with varying contents. | ||
|
||
@if 1 | ||
# foo | ||
@else | ||
|
||
@endif | ||
|
||
@if 1 | ||
1; | ||
|
||
2; | ||
@else | ||
|
||
2; | ||
@endif | ||
|
||
@if ! 1 | ||
1; | ||
@endif | ||
|
||
@if 1 ==1 | ||
|
||
1; | ||
@endif | ||
|
||
# FIXME(bbannier): Empty lines in bodies are currently not removed. | ||
@if | ||
|
||
@else | ||
|
||
@endif | ||
|
||
|
||
# We allow constructs like `import` in preprocessor macros. | ||
@if 1 | ||
import foo ; | ||
|
||
@endif | ||
|
||
# We allow field declarations in preprocessor macros. | ||
type X = unit { | ||
# FIXME(bbannier): preprocessor macros inherit indention, we might not want to do that. | ||
@if 1 | ||
: bytes &size=1; | ||
@endif | ||
}; |
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,41 @@ | ||
# Preprocessor macros with varying contents. | ||
|
||
@if 1 | ||
# foo | ||
@else | ||
@endif | ||
|
||
@if 1 | ||
1; | ||
2; | ||
@else | ||
2; | ||
@endif | ||
|
||
@if !1 | ||
1; | ||
@endif | ||
|
||
@if 1 == 1 | ||
1; | ||
@endif | ||
|
||
# FIXME(bbannier): Empty lines in bodies are currently not removed. | ||
@if | ||
|
||
@else | ||
|
||
@endif | ||
|
||
# We allow constructs like `import` in preprocessor macros. | ||
@if 1 | ||
import foo; | ||
@endif | ||
|
||
# We allow field declarations in preprocessor macros. | ||
type X = unit { | ||
# FIXME(bbannier): preprocessor macros inherit indention, we might not want to do that. | ||
@if 1 | ||
: bytes &size=1; | ||
@endif | ||
}; |
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