This fixes #3362. I added the keywords from Fortran 2018 with the help of a python script (if this has to be done again in the future). The current standard and keywords can be found here: https://j3-fortran.org/doc/year/18/18-007r1.pdf https://github.com/cdslaborg/FortranKeywords
<details> <summary>Script</summary> ```python old_f = open("filetypes.fortran", "r") old_lines = old_f.read().splitlines() old_primary = set() old_intrinsic_functions = set() old_user_functions = set() for line in old_lines: s = line.split("=") if s[0] == "primary": for w in s[1].split(): old_primary.add(w) elif s[0] == "intrinsic_functions": for w in s[1].split(): old_intrinsic_functions.add(w) elif s[0] == "user_functions": for w in s[1].split(): old_user_functions.add(w) old_f.close() f = open("FortranKeywords2018.txt", "r") lines = f.read().splitlines() primary = set() intrinsic_functions = set() user_functions = set() types_primary = {"specifier", "statement", "attribute"} types_intrinsic_functions = { "function_elemental", "function_transformational", "function_inquiry", "function_void", "subroutine", "subroutine_atomic", "subroutine_pure", "constant", "subroutine_collective", "type_derived", "module_intrinsic", } types_user_functions = {} old_maping = { "primary": set(), "intrinsic_functions": set(), "user_functions": set(), "unspecified": set(), } for line in lines: s = line.split(",") ws = s[0].replace("(", " ").replace(")", " ").replace(".", " ").split() # check old maping for w in ws: wl = w.lower() if wl in old_intrinsic_functions and not wl in old_primary : old_maping["intrinsic_functions"].add(s[1]) elif wl in old_primary and not wl in old_intrinsic_functions: old_maping["primary"].add(s[1]) # elif wl in old_user_functions: # old_maping["user_functions"].add(s[1]) old_maping["unspecified"].add(s[1]) old_maping["unspecified"] = ( old_maping["unspecified"] - old_maping["primary"] - old_maping["intrinsic_functions"] - old_maping["user_functions"] ) if s[1] in types_primary: for w in ws: primary.add(w.lower()) elif s[1] in types_intrinsic_functions: for w in ws: intrinsic_functions.add(w.lower()) elif s[1] in types_user_functions: for w in ws: user_functions.add(w.lower()) else: print("not added:", s) if s[0] in old_primary: print("old_primary") if s[0] in old_primary: print("old_intrinsic_functions") f.close() old_dubs = old_intrinsic_functions.intersection(old_primary) wrong = ( primary.intersection(old_intrinsic_functions).union( intrinsic_functions.intersection(old_primary) ) - old_dubs ) print("wrong:", wrong) # print("old duplicates:", old_dubs) # dubs = primary.intersection(intrinsic_functions)-old_dubs # print("dubs:",' '.join(dubs)) print("\nmissing primary:", " ".join(primary - old_primary)) print( "\nmissing intrinsic_functions:", " ".join(intrinsic_functions - old_intrinsic_functions), ) print("\n approximate old maping:", old_maping) # print("legacy:") # print("primary:", old_primary-primary) # print("intrinsic_functions:", old_intrinsic_functions-intrinsic_functions) ``` </details> Some if the keywords are added to both primary and intrinsic_functions, but this was also the case in the past. I mapped keyword categories (from the standard) to "primary" and "intrinsic_functions" like it has been in the past, and new categories like "module_intrinsic" have been added to the most fitting one. As far as I can tell, it is correct and all keywords are handled. Also, I didn't remove any of the existing keywords to keep compatibility to older Fortran versions. <details> <summary>Category Mapping</summary> ```python primary = {"specifier", "statement", "attribute"} intrinsic_functions = { "function_elemental", "function_transformational", "function_inquiry", "function_void", "subroutine", "subroutine_atomic", "subroutine_pure", "constant", "subroutine_collective", "type_derived", "module_intrinsic", } ``` </details> You can view, comment on, or merge this pull request online at: https://github.com/geany/geany/pull/3656 -- Commit Summary -- * update fortran keywords -- File Changes -- M data/filedefs/filetypes.fortran (4) -- Patch Links -- https://github.com/geany/geany/pull/3656.patch https://github.com/geany/geany/pull/3656.diff -- Reply to this email directly or view it on GitHub: https://github.com/geany/geany/pull/3656 You are receiving this because you are subscribed to this thread. Message ID: <geany/geany/pull/3...@github.com>