sub OnPrototypeEnd #( | type, | | prototypeRef, | | ender | ) |
|
Microsoft’s SQL specifies parameters as shown below.
CREATE PROCEDURE Test @as int, @foo int AS ...
Having a parameter @is or @as is perfectly valid even though those words are also used to end the prototype. We need to ignore text-based enders preceded by an at sign. Also note that it does not have parenthesis for parameter lists. We need to skip all commas if the prototype doesn’t have parenthesis but does have @ characters.
Identifiers such as function names may contain the characters $, #, and _, so if “as” or “is” appears directly after one of them we need to ignore the ender there as well.
FUNCTION Something_is_something ...
Parameters
type | The TopicType of the prototype. |
prototypeRef | A reference to the prototype so far, minus the ender in dispute. |
ender | The ender symbol. |
Returns
ENDER_ACCEPT | The ender is accepted and the prototype is finished. |
ENDER_IGNORE | The ender is rejected and parsing should continue. Note that the prototype will be rejected as a whole if all enders are ignored before reaching the end of the code. |
ENDER_ACCEPT_AND_CONTINUE | The ender is accepted so the prototype may stand as is. However, the prototype might also continue on so continue parsing. If there is no accepted ender between here and the end of the code this version will be accepted instead. |
ENDER_REVERT_TO_ACCEPTED | The expedition from ENDER_ACCEPT_AND_CONTINUE failed. Use the last accepted version and end parsing. |