| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112 |
- <?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>
|