You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
112 lines
3.9 KiB
112 lines
3.9 KiB
<?xml version="1.0" encoding="UTF-8" ?>
|
|
<!-- ==========================================================================\
|
|
|
|
|
| To learn how to make your own language parser, please check the following
|
|
| link:
|
|
| https://npp-user-manual.org/docs/function-list/
|
|
|
|
|
\=========================================================================== -->
|
|
<NotepadPlus>
|
|
<functionList>
|
|
<!-- =========================================================== [ C ] -->
|
|
<parser
|
|
displayName="C"
|
|
id ="c_function"
|
|
commentExpr="(?x) # Utilize inline comments (see `RegEx - Pattern Modifiers`)
|
|
(?s:\x2F\x2A.*?\x2A\x2F) # Multi Line Comment
|
|
| (?m-s:\x2F{2}.*$) # Single Line Comment
|
|
| (?s:\x22(?:[^\x22\x5C]|\x5C.)*\x22) # String Literal - Double Quoted
|
|
| (?s:\x27(?:[^\x27\x5C]|\x5C.)*\x27) # String Literal - Single Quoted
|
|
"
|
|
>
|
|
<function
|
|
mainExpr="(?x) # Utilize inline comments (see `RegEx - Pattern Modifiers`)
|
|
(?: # Declaration specifiers
|
|
\b
|
|
(?:
|
|
(?-i:auto|register|static|extern|typedef) # Storage class specifier
|
|
| (?: # Type specifier
|
|
(?-i:void|char|short|int|long|float|double|(?:un)?signed)
|
|
| (?-i:struct|union|enum)
|
|
\s+
|
|
(?&VALID_ID) # Struct, Union or Enum Specifier (simplified)
|
|
| (?&VALID_ID) # Type-definition name
|
|
)
|
|
| (?'TYPE_QUALIFIER'(?-i:const|volatile))
|
|
)
|
|
\b
|
|
\s*
|
|
)*
|
|
(?'DECLARATOR'
|
|
(?'POINTER'
|
|
\*
|
|
\s*
|
|
(?:
|
|
\b(?&TYPE_QUALIFIER)\b
|
|
\s*
|
|
)*
|
|
(?:(?&POINTER))? # Boost::Regex 1.58-1.59 do not correctly handle quantifiers on subroutine calls
|
|
)?
|
|
(?: # 'DIRECT_DECLARATOR'
|
|
\s*
|
|
(?'VALID_ID' # valid identifier, use as subroutine
|
|
\b(?!(?-i:
|
|
auto
|
|
| break
|
|
| c(?:ase|har|on(?:st|ntinue))
|
|
| d(?:efault|o(?:uble)?)
|
|
| e(?:lse|num|xtern)
|
|
| f(?:loat|or)
|
|
| goto
|
|
| i(?:f|n(?:t|line))
|
|
| long
|
|
| while
|
|
| re(?:gister|strict|turn)
|
|
| s(?:hort|i(?:gned|zeof)|t(?:atic|ruct)|witch)
|
|
| typedef
|
|
| un(?:ion|signed)
|
|
| vo(?:id|latile)
|
|
| _(?:
|
|
A(?:lignas|lignof|tomic)
|
|
| Bool
|
|
| Complex
|
|
| Generic
|
|
| Imaginary
|
|
| Noreturn
|
|
| Static_assert
|
|
| Thread_local
|
|
)
|
|
)\b) # keywords, not to be used as identifier
|
|
[A-Za-z_\x7F-\xFF][\w\x7F-\xFF]* # valid character combination for identifiers
|
|
)
|
|
| \s*\(
|
|
(?&DECLARATOR)
|
|
\)
|
|
| \s*(?&VALID_ID)
|
|
\s*\[
|
|
[^[\];{]*?
|
|
\]
|
|
| \s*(?&VALID_ID)
|
|
\s*\(
|
|
[^();{]*?
|
|
\)
|
|
)
|
|
\s*
|
|
)
|
|
(?=\{) # start of function body
|
|
"
|
|
>
|
|
<functionName>
|
|
<nameExpr expr="(?x) # Utilize inline comments (see `RegEx - Pattern Modifiers`)
|
|
[A-Za-z_\x7F-\xFF][\w\x7F-\xFF]*
|
|
\s*\( # start of parameters
|
|
(?s:.*?) # whatever, until...
|
|
\) # end of parameters
|
|
" />
|
|
<!-- comment out the following node to display the method with its parameters -->
|
|
<!-- <nameExpr expr="[A-Za-z_\x7F-\xFF][\w\x7F-\xFF]*" /> -->
|
|
</functionName>
|
|
</function>
|
|
</parser>
|
|
</functionList>
|
|
</NotepadPlus> |