/
(?x)
# Set intent level
(?(DEFINE)(?<indent>[[:space:]]{4}))
# Must start at new line
^
# Captures following statement's description comment lines if written
(?<statementDescComment>
(?:
# Repeat below until next line not comment
(?=(?P>indent)\/)\V*\v
)+
)?
# Generic Statement Capture
(?<statement>
# Const declaration capture
(?<const>
(?P>indent)const[[:space:]]*\([[:space:]]*
\v
(?:
(?!(?P>indent)\))\V*\v
)*
(?P>indent)\)
)
|
# Full function declaration capture
(?<func>
# Function declaration initialization
(?<funcDecLine>
(?P>indent)func\V+
)\v
# Repeat subcapture until line starting with close bracket
(?:
(?!(?P>indent)\})\V*\v
)*
# Closing bracket
(?<funcCloseBracket>(?P>indent)\})
)
|
(?<type>
# Type Declaration
# Check before wasting time
(?=(?P>indent)type)
# Short Form