RegEx/OpenSCAD/Function.regex.txt
# Matches Open SCAD Functions (?m) # Set Multiline mode. Then, (?<Comments>//[\s.]{0,}?$(?>\r\n|\n)){0,}^function # match the literal 'function' \s+ # and the obligitory whitespace. (?<Name>\w+) # Then match and extract the .Name \s{0,} # Then, there may be whitespace. # The .Parameters are within () (?<Parameters> \( # An open parenthesis (?> # Followed by... [^\(\)]+| # any number of non-parenthesis character OR \((?<Depth>)| # an open parenthesis (in which case increment depth) OR \)(?<-Depth>) # a closed parenthesis (in which case decrement depth) )*(?(Depth)(?!)) # until depth is 0. \) # followed by a closing parenthesis )\s{0,} # Then, there may be whitespace. \=\s{0,} # Then, there may be whitespace. (?:.|\s){0,}?(?=\z|;) |