Skip to content

Support selected Intel-specific preprocessor macro expansions #341

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

Open
wants to merge 24 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
05f93a7
allow for whitespace in PP directives, better def arg regex
emanspeaks Dec 11, 2023
f297da5
add draft of unit test
emanspeaks Jan 3, 2024
d23088d
Merge branch 'master' into ifort-fpp-fixes
emanspeaks Jan 3, 2024
37752c8
revert changes to try to fix unit tests
emanspeaks Jan 3, 2024
4367f32
everything working but the def regex
emanspeaks Jan 3, 2024
1b3735e
working regex that is at least backwards compatible
emanspeaks Jan 3, 2024
3ddeb00
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 3, 2024
6e63f04
working version of macro expansion w/ tests
emanspeaks Jan 3, 2024
e1ce5eb
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 3, 2024
0b6fbaa
housekeeping
emanspeaks Jan 3, 2024
ccb4d37
replace \s* with [ ]*
emanspeaks Jan 3, 2024
b7c3572
attempt to remedy regex warnings
emanspeaks Jan 4, 2024
efed76f
second attempt to fix regex warnings
emanspeaks Jan 4, 2024
c62ef0f
remove ambiguous define arg matching
emanspeaks Jan 4, 2024
107180d
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 4, 2024
0ecc55d
additional support for Intel FPP
emanspeaks Jan 7, 2024
0de9e0e
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 7, 2024
1ea9700
fix issue with json schema
emanspeaks Jan 7, 2024
755370e
addl logical operators for intel fpp
emanspeaks Jan 7, 2024
9b67c67
parse intel fpp operators separately
emanspeaks Jan 7, 2024
ad4de4c
init commit of cherry-picked changes from #341
emanspeaks Jan 21, 2024
5cf36e3
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 21, 2024
6245d85
Merge branch 'generic-macro-expansions' into ifort-fpp-fixes
emanspeaks Jan 21, 2024
c975006
rebase intel-specific changes on top of PR #350
emanspeaks Jan 21, 2024
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
11 changes: 7 additions & 4 deletions fortls/regex_patterns.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,11 +124,14 @@ class FortranRegularExpressions:
FREE_FORMAT_TEST: Pattern = compile(r"[ ]{1,4}[a-z]", I)
# Preprocessor matching rules
DEFINED: Pattern = compile(r"defined[ ]*\(?[ ]*([a-z_]\w*)[ ]*\)?", I)
PP_REGEX: Pattern = compile(r"#(if |ifdef|ifndef|else|elif|endif)")
PP_DEF: Pattern = compile(r"#(define|undef)[ ]*([\w]+)(\((\w+(,[ ]*)?)+\))?", I)
PP_REGEX: Pattern = compile(r"#[ ]*(if |ifdef|ifndef|else|elif|endif)")
PP_DEF: Pattern = compile(
r"#[ ]*(define|undef)[ ]*([\w]+)[ ]*(\([ ]*(\w+[ ]*,?[ \w,]*\w+)+[ ]*\))?",
I,
)
PP_DEF_TEST: Pattern = compile(r"(![ ]*)?defined[ ]*\([ ]*(\w*)[ ]*\)$", I)
PP_INCLUDE: Pattern = compile(r"#include[ ]*([\"\w\.]*)", I)
PP_ANY: Pattern = compile(r"(^#:?\w+)")
PP_INCLUDE: Pattern = compile(r"#[ ]*include[ ]*([\"\w\.]*)", I)
PP_ANY: Pattern = compile(r"(^#[\w]*:?\w+)")
# Context matching rules
CALL: Pattern = compile(r"[ ]*CALL[ ]+[\w%]*$", I)
INT_STMNT: Pattern = compile(r"^[ ]*[a-z]*$", I)
Expand Down