4242*/
4343
4444/**
45- * Skips white-spaces in the buffer. Here the white-spaces includes commas,
46- * which is treated as a space in FORM.
45+ * Skips over whitespace characters in the buffer, including commas,
46+ * which are treated as whitespace characters in the FORM compiler .
4747 *
48- * @param[in,out] s The pointer to the buffer.
48+ * @note To avoid skipping commas, use `SKIPBLANKS(s)` instead.
49+ *
50+ * @param[in,out] s Pointer to the current position in the buffer. The buffer
51+ * must be null-terminated. On return, the pointer is
52+ * advanced to the first non-whitespace character, or the
53+ * null terminator if none is found.
4954 */
5055static inline void SkipSpaces (UBYTE * * s )
5156{
@@ -55,13 +60,15 @@ static inline void SkipSpaces(UBYTE **s)
5560}
5661
5762/**
58- * Checks if the next word in the buffer is the given keyword, with ignoring
59- * case. If found, the pointer is moved such that the keyword is consumed in the
60- * buffer, and this function returns a non-zero value .
63+ * Checks whether the next token in the buffer is the given keyword,
64+ * ignoring case. If found, the keyword is consumed and the pointer is advanced
65+ * to the first non-whitespace character following the keyword .
6166 *
62- * @param[in,out] s The pointer to the buffer. Changed if the keyword found.
63- * @param opt The optional keyword.
64- * @return 1 if the keyword found, otherwise 0.
67+ * @param[in,out] s Pointer to the current position in the buffer.
68+ * The buffer must be null-terminated. On return,
69+ * the pointer is advanced if the keyword is found.
70+ * @param opt Case-insensitive keyword.
71+ * @return 1 if the keyword is found, otherwise 0.
6572 */
6673static inline int ConsumeOption (UBYTE * * s , const char * opt )
6774{
@@ -73,10 +80,9 @@ static inline int ConsumeOption(UBYTE **s, const char *opt)
7380 /* Check if `opt` ended. */
7481 if ( !* opt ) {
7582 /* Check if `*p` is a word boundary. */
76- if ( !* p || !(FG .cTable [(unsigned char )* p ] == 0 ||
77- FG .cTable [(unsigned char )* p ] == 1 || * p == '_' ||
78- * p == '$' ) ) {
79- /* Consume the option. Skip the trailing spaces. */
83+ UINT c = FG .cTable [(unsigned char )* p ];
84+ if ( c != 0 && c != 1 && * p != '_' && * p != '$' ) {
85+ /* Consume the option. Skip the trailing whitespace. */
8086 * s = (UBYTE * )p ;
8187 SkipSpaces (s );
8288 return (1 );
0 commit comments