Skip to content
Spiralo-Idioide edited this page May 3, 2021 · 1 revision

Table of Contents

GP syntax Regex parser

 For the moment the regexes are tested for javascript (Ecmascript) and QRegExp (for Kate editor and other KDE programs). They are made with syntax highlighting in mind and not for other uses.

 You can see examples of the regexes by clicking on the links.

 Regexes that match ‘everything’ will match the whole expression and create individual groups for every element.

Definitions & Declarations

 Regexes that match ‘everything’ match the whole expression and create individual groups for every element. Those regexes will match 16 args max.

Methods

Regexes
Name Javascript : (?<=^defineClass '?)[^ '\n]+
QRegExp : (^\|\n)method '?\K[^ '\n]+
Everything Javascript/QRegExp : (?:^method )(?:'?)(?<funcName>[^ ']+)(?:'?)(?: )(?<className>\w+)(?: )(?:(?:(?:(\w+)(?: ))?(?:(\w+)(?: ))?(?:(\w+)(?: ))?(?:(\w+)(?: ))?(?:(\w+)(?: ))?(?:(\w+)(?: ))?(?:(\w+)(?: ))?(?:(\w+)(?: ))?(?:(\w+)(?: ))?(?:(\w+)(?: ))?(?:(\w+)(?: ))?(?:(\w+)(?: ))?(?:(\w+)(?: ))?(?:(\w+)(?: ))?(?:(\w+)(?: ))?(?:(\w+)(?: ))?))(?<argsList>args[.]{3} )?

Global Functions

Regexes
Name Javascript : (?<=^to '?)[^ '\n]+
QRegExp : (^\|\n)to '?\K[^ '\n]+
Everything Javascript/QRegExp : (?<=^\|\n)(?:to )(?:'?)(?<funcName>[^ '\n]+)(?:'?)(?: )(?:(?:(?:(\w+)(?: ))?(?:(\w+)(?: ))?(?:(\w+)(?: ))?(?:(\w+)(?: ))?(?:(\w+)(?: ))?(?:(\w+)(?: ))?(?:(\w+)(?: ))?(?:(\w+)(?: ))?(?:(\w+)(?: ))?(?:(\w+)(?: ))?(?:(\w+)(?: ))?(?:(\w+)(?: ))?(?:(\w+)(?: ))?(?:(\w+)(?: ))?(?:(\w+)(?: ))?(?:(\w+)(?: ))?))(?<argsList>args[.]{3} )?

Classes

Regexes
Name Javascript : (?<=^defineClass '?)[^ '\n]+
QRegExp : (^|\n)defineClass '?\K[^ '\n]+
Everything Javascript/QRegExp : (?:^defineClass )(?:'?)(?<className>\w+)(?:'?)(?: )?(?:(?:(?:(\w+)(?: ))?(?:(\w+)(?: ))?(?:(\w+)(?: ))?(?:(\w+)(?: ))?(?:(\w+)(?: ))?(?:(\w+)(?: ))?(?:(\w+)(?: ))?(?:(\w+)(?: ))?(?:(\w+)(?: ))?(?:(\w+)(?: ))?(?:(\w+)(?: ))?(?:(\w+)(?: ))?(?:(\w+)(?: ))?(?:(\w+)(?: ))?(?:(\w+)(?: ))?(?:(\w+))?))

Comments

Comment function (comment 'text')

Regexes
Name Javascript : (?<=(?:^|\n)[ \t]*(?:comment '))((?:''|[^'])*)
QRegExp : (^|\n)[ \t]*comment '\K((''|[^'])*)
Everything Javascript : (?<=(?:^|\n)[ \t]*)(?:comment ')(?<text>(?:''|[^'])*)(?:')
QRegExp : (?:^|\n)[ \t]*\K(?:comment ')(?<text>(?:''|[^'])*)(?:')