Parsing of declarations in all branches of preprocessor conditionals
First Claim
1. A system that parses a plurality of preprocessor conditional branches of a preprocessor conditional directive statement comprising:
- a computer comprising a processor and a memory, the computer further comprising;
a declaration serializer that;
obtains tokenized input;
in response to determining that the tokenized input represents a declaration, wherein the declaration is interrupted by a preprocessor conditional directive of a preprocessor conditional directive statement, wherein the preprocessor conditional directive statement comprises a plurality of mutually exclusive branches comprising at least a first branch and a second branch;
labels each token of the interrupted declaration with at least a first parsing path indicator of a plurality of parsing path indicators, the at least first parsing path indicator corresponding to a first parsing path, and wherein a second parsing path indicator corresponds to a second parsing path, wherein each of the plurality of parsing paths is induced by the plurality of mutually exclusive branches of the preprocessor conditional directive statement; and
returns the tokens labeled with the at least first parsing path indicator in a first pass to a caller.
2 Assignments
0 Petitions
Accused Products
Abstract
Declarations from an input source code or tokenized source code are serialized into a stream of tokens produced by following each branch of a preprocessor conditional directive statement that interrupts a declaration. Tokens are labeled with a parsing path indicator corresponding to a parsing path induced by branches of a preprocessor conditional directive. The declarations that are formed along the different parsing paths are serialized by fetching the tokens that belong to the first parsing path in a first pass, and passing the tokens on to a next phase of a compiler. The pointer that marks the next token is repositioned to return to the start of the declaration. The declaration may be serialized again through the second parsing path in a second pass. The operation may be repeated until each of the parsing paths induced by the presence of branches of the preprocessor conditional directives in the source code is exhausted.
-
Citations
19 Claims
-
1. A system that parses a plurality of preprocessor conditional branches of a preprocessor conditional directive statement comprising:
-
a computer comprising a processor and a memory, the computer further comprising; a declaration serializer that; obtains tokenized input; in response to determining that the tokenized input represents a declaration, wherein the declaration is interrupted by a preprocessor conditional directive of a preprocessor conditional directive statement, wherein the preprocessor conditional directive statement comprises a plurality of mutually exclusive branches comprising at least a first branch and a second branch; labels each token of the interrupted declaration with at least a first parsing path indicator of a plurality of parsing path indicators, the at least first parsing path indicator corresponding to a first parsing path, and wherein a second parsing path indicator corresponds to a second parsing path, wherein each of the plurality of parsing paths is induced by the plurality of mutually exclusive branches of the preprocessor conditional directive statement; and returns the tokens labeled with the at least first parsing path indicator in a first pass to a caller. - View Dependent Claims (2, 3, 4, 5, 6)
-
-
7. A method of parsing a plurality of preprocessor conditional branches of a preprocessor conditional directive statement comprising:
-
obtaining tokenized input; in response to determining that the tokenized input represents a declaration, wherein the declaration is interrupted by a preprocessor conditional directive of a preprocessor conditional directive statement, wherein the preprocessor conditional directive statement comprises a plurality of mutually exclusive branches comprising at least a first branch and a second branch; using a processor, labeling each token of the interrupted declaration with at least a first parsing path indicator of a plurality of parsing path indicators, the at least first parsing path indicator corresponding to a first parsing path, and wherein a second parsing path indicator corresponds to a second parsing path, wherein each of the plurality of parsing paths is induced by the plurality of mutually exclusive branches of the preprocessor conditional directive statement; and returning the tokens labeled with the at least first parsing path indicator in a first pass to a caller. - View Dependent Claims (8, 9, 10)
-
-
11. A computer-readable storage medium storing computer-executable instructions which when executed cause a computing environment to:
-
obtain tokenized input representing a declaration; in response to determining that the tokenized input represents a declaration, wherein the declaration is interrupted by a preprocessor conditional directive of a preprocessor conditional directive statement, wherein the preprocessor conditional directive statement comprises a plurality of mutually exclusive branches comprising at least a first branch and a second branch, label each token of the interrupted declaration with at least a first parsing path indicator of a plurality of parsing path indicators, the at least first parsing path indicator corresponding to a first parsing path, and wherein a second parsing path indicator corresponds to a second parsing path, wherein each of the plurality of parsing paths is induced by the plurality of mutually exclusive branches of the preprocessor conditional directive statement; store the labeled tokens in a token buffer; and return the tokens labeled with the at least first parsing path indicator to a caller in a first pass of the token buffer and return the tokens labeled with the second parsing path indicator to the caller in a second pass of the token buffer. - View Dependent Claims (12, 13, 14, 15, 16, 17, 18, 19)
-
Specification