752 |
} |
} |
753 |
|
|
754 |
(void) next_char (context); |
(void) next_char (context); |
755 |
if (M4_IS_BCOMM (M4SYNTAX, ch)) /* COMMENT, SHORT DELIM */ |
if (m4_has_syntax (M4SYNTAX, ch, M4_SYNTAX_BCOMM)) |
756 |
{ |
{ /* COMMENT, SHORT DELIM */ |
757 |
obstack_1grow (&token_stack, ch); |
obstack_1grow (&token_stack, ch); |
758 |
while ((ch = next_char (context)) != CHAR_EOF |
while ((ch = next_char (context)) != CHAR_EOF |
759 |
&& !M4_IS_ECOMM (M4SYNTAX, ch)) |
&& !m4_has_syntax (M4SYNTAX, ch, M4_SYNTAX_ECOMM)) |
760 |
obstack_1grow (&token_stack, ch); |
obstack_1grow (&token_stack, ch); |
761 |
if (ch != CHAR_EOF) |
if (ch != CHAR_EOF) |
762 |
obstack_1grow (&token_stack, ch); |
obstack_1grow (&token_stack, ch); |
763 |
type = m4_get_discard_comments_opt (context) |
type = m4_get_discard_comments_opt (context) |
764 |
? M4_TOKEN_NONE : M4_TOKEN_STRING; |
? M4_TOKEN_NONE : M4_TOKEN_STRING; |
765 |
} |
} |
|
/* COMMENT, LONGER DELIM */ |
|
766 |
else if (!m4_is_syntax_single_comments (M4SYNTAX) |
else if (!m4_is_syntax_single_comments (M4SYNTAX) |
767 |
&& MATCH (context, ch, context->syntax->bcomm.string)) |
&& MATCH (context, ch, context->syntax->bcomm.string)) |
768 |
{ |
{ /* COMMENT, LONGER DELIM */ |
769 |
obstack_grow (&token_stack, context->syntax->bcomm.string, |
obstack_grow (&token_stack, context->syntax->bcomm.string, |
770 |
context->syntax->bcomm.length); |
context->syntax->bcomm.length); |
771 |
while ((ch = next_char (context)) != CHAR_EOF |
while ((ch = next_char (context)) != CHAR_EOF |
777 |
type = m4_get_discard_comments_opt (context) |
type = m4_get_discard_comments_opt (context) |
778 |
? M4_TOKEN_NONE : M4_TOKEN_STRING; |
? M4_TOKEN_NONE : M4_TOKEN_STRING; |
779 |
} |
} |
780 |
else if (M4_IS_ESCAPE (M4SYNTAX, ch)) /* ESCAPED WORD */ |
else if (m4_has_syntax (M4SYNTAX, ch, M4_SYNTAX_ESCAPE)) |
781 |
{ |
{ /* ESCAPED WORD */ |
782 |
obstack_1grow (&token_stack, ch); |
obstack_1grow (&token_stack, ch); |
783 |
if ((ch = next_char (context)) != CHAR_EOF) |
if ((ch = next_char (context)) != CHAR_EOF) |
784 |
{ |
{ |
785 |
if (M4_IS_ALPHA (M4SYNTAX, ch)) |
if (m4_has_syntax (M4SYNTAX, ch, M4_SYNTAX_ALPHA)) |
786 |
{ |
{ |
787 |
obstack_1grow (&token_stack, ch); |
obstack_1grow (&token_stack, ch); |
788 |
while ((ch = next_char (context)) != CHAR_EOF |
while ((ch = next_char (context)) != CHAR_EOF |
789 |
&& (M4_IS_ALNUM (M4SYNTAX, ch))) |
&& (m4_is_syntax (M4SYNTAX, ch, M4_SYNTAX_ALPHA) |
790 |
|
|| m4_is_syntax (M4SYNTAX, ch, M4_SYNTAX_NUM))) |
791 |
{ |
{ |
792 |
obstack_1grow (&token_stack, ch); |
obstack_1grow (&token_stack, ch); |
793 |
} |
} |
807 |
type = M4_TOKEN_SIMPLE; /* escape before eof */ |
type = M4_TOKEN_SIMPLE; /* escape before eof */ |
808 |
} |
} |
809 |
} |
} |
810 |
else if (M4_IS_ALPHA (M4SYNTAX, ch)) |
else if (m4_has_syntax (M4SYNTAX, ch, M4_SYNTAX_ALPHA)) |
811 |
{ |
{ |
812 |
obstack_1grow (&token_stack, ch); |
obstack_1grow (&token_stack, ch); |
813 |
while ((ch = next_char (context)) != CHAR_EOF |
while ((ch = next_char (context)) != CHAR_EOF |
814 |
&& (M4_IS_ALNUM (M4SYNTAX, ch))) |
&& (m4_is_syntax (M4SYNTAX, ch, M4_SYNTAX_ALPHA) |
815 |
|
|| m4_is_syntax (M4SYNTAX, ch, M4_SYNTAX_NUM))) |
816 |
{ |
{ |
817 |
obstack_1grow (&token_stack, ch); |
obstack_1grow (&token_stack, ch); |
818 |
} |
} |
822 |
type = m4_is_syntax_macro_escaped (M4SYNTAX) |
type = m4_is_syntax_macro_escaped (M4SYNTAX) |
823 |
? M4_TOKEN_STRING : M4_TOKEN_WORD; |
? M4_TOKEN_STRING : M4_TOKEN_WORD; |
824 |
} |
} |
825 |
else if (M4_IS_LQUOTE (M4SYNTAX, ch)) /* QUOTED STRING, SINGLE QUOTES */ |
else if (m4_has_syntax (M4SYNTAX, ch, M4_SYNTAX_LQUOTE)) |
826 |
{ |
{ /* QUOTED STRING, SINGLE QUOTES */ |
827 |
const char *current_file = m4_current_file; |
const char *current_file = m4_current_file; |
828 |
int current_line = m4_current_line; |
int current_line = m4_current_line; |
829 |
quote_level = 1; |
quote_level = 1; |
835 |
current_file, current_line, |
current_file, current_line, |
836 |
_("EOF in string")); |
_("EOF in string")); |
837 |
|
|
838 |
if (M4_IS_RQUOTE (M4SYNTAX, ch)) |
if (m4_has_syntax (M4SYNTAX, ch, M4_SYNTAX_RQUOTE)) |
839 |
{ |
{ |
840 |
if (--quote_level == 0) |
if (--quote_level == 0) |
841 |
break; |
break; |
842 |
obstack_1grow (&token_stack, ch); |
obstack_1grow (&token_stack, ch); |
843 |
} |
} |
844 |
else if (M4_IS_LQUOTE (M4SYNTAX, ch)) |
else if (m4_has_syntax (M4SYNTAX, ch, M4_SYNTAX_LQUOTE)) |
845 |
{ |
{ |
846 |
quote_level++; |
quote_level++; |
847 |
obstack_1grow (&token_stack, ch); |
obstack_1grow (&token_stack, ch); |
851 |
} |
} |
852 |
type = M4_TOKEN_STRING; |
type = M4_TOKEN_STRING; |
853 |
} |
} |
|
/* QUOTED STRING, LONGER QUOTES */ |
|
854 |
else if (!m4_is_syntax_single_quotes (M4SYNTAX) |
else if (!m4_is_syntax_single_quotes (M4SYNTAX) |
855 |
&& MATCH (context, ch, context->syntax->lquote.string)) |
&& MATCH (context, ch, context->syntax->lquote.string)) |
856 |
{ |
{ /* QUOTED STRING, LONGER QUOTES */ |
857 |
const char *current_file = m4_current_file; |
const char *current_file = m4_current_file; |
858 |
int current_line = m4_current_line; |
int current_line = m4_current_line; |
859 |
quote_level = 1; |
quote_level = 1; |
883 |
type = M4_TOKEN_STRING; |
type = M4_TOKEN_STRING; |
884 |
} |
} |
885 |
else if (m4_is_syntax_single_quotes (M4SYNTAX) |
else if (m4_is_syntax_single_quotes (M4SYNTAX) |
886 |
&& m4_is_syntax_single_comments (M4SYNTAX)) /* EVERYTHING ELSE */ |
&& m4_is_syntax_single_comments (M4SYNTAX)) |
887 |
{ |
{ /* EVERYTHING ELSE (SHORT QUOTES AND COMMENTS) */ |
888 |
obstack_1grow (&token_stack, ch); |
obstack_1grow (&token_stack, ch); |
889 |
|
|
890 |
if (M4_IS_OTHER (M4SYNTAX, ch) || M4__IS_STRING (M4SYNTAX, ch)) |
if (m4_is_syntax (M4SYNTAX, ch, M4_SYNTAX_OTHER) |
891 |
{ |
|| m4_is_syntax (M4SYNTAX, ch, M4_SYNTAX_NUM) |
892 |
while ((ch = next_char(context)) != CHAR_EOF |
|| m4_is_syntax (M4SYNTAX, ch, M4_SYNTAX_DOLLAR)) |
893 |
&& (M4_IS_OTHER (M4SYNTAX, ch) |
{ |
894 |
|| M4__IS_STRING (M4SYNTAX, ch))) |
while (((ch = next_char(context)) != CHAR_EOF) |
895 |
|
&& (m4_is_syntax (M4SYNTAX, ch, M4_SYNTAX_OTHER) |
896 |
|
|| m4_is_syntax (M4SYNTAX, ch, M4_SYNTAX_NUM) |
897 |
|
|| m4_is_syntax (M4SYNTAX, ch, M4_SYNTAX_DOLLAR))) |
898 |
{ |
{ |
899 |
obstack_1grow (&token_stack, ch); |
obstack_1grow (&token_stack, ch); |
900 |
} |
} |
903 |
unget_input(ch); |
unget_input(ch); |
904 |
type = M4_TOKEN_STRING; |
type = M4_TOKEN_STRING; |
905 |
} |
} |
906 |
else if (M4_IS_SPACE (M4SYNTAX, ch)) |
else if (m4_has_syntax (M4SYNTAX, ch, M4_SYNTAX_SPACE)) |
907 |
{ |
{ |
908 |
if (!m4_get_interactive_opt (context)) |
if (!m4_get_interactive_opt (context)) |
909 |
{ |
{ |
910 |
while ((ch = next_char (context)) != CHAR_EOF |
while ((ch = next_char (context)) != CHAR_EOF |
911 |
&& M4_IS_SPACE (M4SYNTAX, ch)) |
&& m4_has_syntax (M4SYNTAX, ch, M4_SYNTAX_SPACE)) |
912 |
obstack_1grow (&token_stack, ch); |
obstack_1grow (&token_stack, ch); |
913 |
|
|
914 |
if (ch != CHAR_EOF) |
if (ch != CHAR_EOF) |
916 |
} |
} |
917 |
type = M4_TOKEN_SPACE; |
type = M4_TOKEN_SPACE; |
918 |
} |
} |
919 |
else if (M4_IS_ACTIVE (M4SYNTAX, ch)) |
else if (m4_has_syntax (M4SYNTAX, ch, M4_SYNTAX_ACTIVE)) |
920 |
type = M4_TOKEN_WORD; |
type = M4_TOKEN_WORD; |
921 |
else |
else |
922 |
type = M4_TOKEN_SIMPLE; |
type = M4_TOKEN_SIMPLE; |
923 |
} |
} |
924 |
else /* EVERYTHING ELSE AGAIN?! */ |
else /* EVERYTHING ELSE (LONG QUOTES OR COMMENTS) */ |
925 |
{ |
{ |
926 |
obstack_1grow (&token_stack, ch); |
obstack_1grow (&token_stack, ch); |
927 |
|
|
928 |
if (M4_IS_OTHER (M4SYNTAX, ch) || M4__IS_STRING (M4SYNTAX, ch)) |
if (m4_is_syntax (M4SYNTAX, ch, M4_SYNTAX_OTHER) |
929 |
|
|| m4_is_syntax (M4SYNTAX, ch, M4_SYNTAX_NUM) |
930 |
|
|| m4_is_syntax (M4SYNTAX, ch, M4_SYNTAX_DOLLAR)) |
931 |
type = M4_TOKEN_STRING; |
type = M4_TOKEN_STRING; |
932 |
else if (M4_IS_SPACE (M4SYNTAX, ch)) |
else if (m4_has_syntax (M4SYNTAX, ch, M4_SYNTAX_SPACE)) |
933 |
type = M4_TOKEN_SPACE; |
type = M4_TOKEN_SPACE; |
934 |
else if (M4_IS_ACTIVE (M4SYNTAX, ch)) |
else if (m4_has_syntax (M4SYNTAX, ch, M4_SYNTAX_ACTIVE)) |
935 |
type = M4_TOKEN_WORD; |
type = M4_TOKEN_WORD; |
936 |
else |
else |
937 |
type = M4_TOKEN_SIMPLE; |
type = M4_TOKEN_SIMPLE; |