Community
Participate
Working Groups
The GNUCSourceParser does not allow for the creation of a compeltion node in the condition of a switch statement. The GNUCPPSourceParser does not allow for the creation of completion nodes in conditions of switch or while statements.
Created attachment 67150 [details] proposed patch GNUCSourceParser and GNUCPPSourceParser now handle EOC tokens in parseWhileStatement() and parseSwitchStatement().
Patch applied. Thanks, Bryan! I didn't realize the parser didn't even support content assist there. Good catch.
Verified that this works for the C99 parser. The C99 grammar file has five simple grammar rules that handle all the possible cases where a completion token can occur. ident ::= 'identifier' | 'Completion' ']' ::=? 'RightBracket' | 'EndOfCompletion' ')' ::=? 'RightParen' | 'EndOfCompletion' '}' ::=? 'RightBrace' | 'EndOfCompletion' ';' ::=? 'SemiColon' | 'EndOfCompletion' Basically this says that a Completion token can occur at any point where an identifier token can occur. The input token stream will always contain only EndOfCompletion tokens after a Completion token, the last 4 rules allows the parser to use the EndOfCompletion tokens to return a successful parse. The language grammar itself is completely untouched by the content assist mechanism. The solution is completely general and does not require modification for every case where a Completion token could occur. (Of course these grammar rules lead to tons of shift/reduce conflicts, but they are resolved by giving them higher priority by using '::=?' instead of '::=').
assigning
done