Re: Last Enum member not found

Jason Hood <[email protected]>
Newsgroups gmane.comp.gnu.global.bugs
Message-ID <[email protected]>
On 4/12/2015 1:59, Hideki IWAMOTO wrote:
> Global couldn't handle in the case that there are newlines between "enum" and " {". 
> This bug was fixed in the repository.

This still misses this construct:

	enum
	tag
	{ ... };

My solution skipped newlines straight after the attributes.

-- 
Jason.

_______________________________________________
Bug-global mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/bug-global
enum.txt (text/plain, 1.8 KB)
diff -urp global-6.5.1/libparser/C.c global-6.5-1/libparser/C.c
--- global-6.5.1/libparser/C.c	2015-09-15 12:48:18 +1000
+++ global-6.5-1/libparser/C.c	2015-12-04 15:34:57 +1000
@@ -299,6 +299,8 @@ C_family(const struct parser_param *para
 		case C_UNION:
 			while ((c = nexttoken(interested, c_reserved_word)) == C___ATTRIBUTE__)
 				process_attribute(param);
+			while (c == '\n')
+				c = nexttoken(interested, c_reserved_word);
 			if (c == SYMBOL) {
 				if (peekc(0) == '{') /* } */ {
 					PUT(PARSER_DEF, token, lineno, sp);
@@ -358,6 +360,8 @@ C_family(const struct parser_param *para
 
 					while ((c = nexttoken(interest_enum, c_reserved_word)) == C___ATTRIBUTE__)
 						process_attribute(param);
+					while (c == '\n')
+						c = nexttoken(interest_enum, c_reserved_word);
 					/* read tag name if exist */
 					if (c == SYMBOL) {
 						if (peekc(0) == '{') /* } */ {
diff -urp global-6.5.1/libparser/Cpp.c global-6.5-1/libparser/Cpp.c
--- global-6.5.1/libparser/Cpp.c	2015-09-15 12:48:18 +1000
+++ global-6.5-1/libparser/Cpp.c	2015-12-04 15:36:42 +1000
@@ -367,6 +367,8 @@ Cpp(const struct parser_param *param)
 		case CPP_UNION:
 			while ((c = nexttoken(interested, cpp_reserved_word)) == CPP___ATTRIBUTE__)
 				process_attribute(param);
+			while (c == '\n')
+				c = nexttoken(interested, cpp_reserved_word);
 			if (c == SYMBOL) {
 				if (peekc(0) == '{') /* } */ {
 					PUT(PARSER_DEF, token, lineno, sp);
@@ -464,6 +466,8 @@ Cpp(const struct parser_param *param)
 
 					while ((c = nexttoken(interest_enum, cpp_reserved_word)) == CPP___ATTRIBUTE__)
 						process_attribute(param);
+					while (c == '\n')
+						c = nexttoken(interest_enum, cpp_reserved_word);
 					/* read tag name if exist */
 					if (c == SYMBOL) {
 						if (peekc(0) == '{') /* } */ {
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.