Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] access IBinary file?

Hi Mike,
Thanks a lot for the answer!
I have a written a grammar that was received by adding/dropping rules
in UPC/C99 and the generated parser seems reducing rules correctly.

Now I want to reuse as much as possible the parser action classes
(C99BuildASTParserAction, BuildASTParserAction, AbstractParserAction)
in the manner that will cause the
1) Syntax highlighting
2) Code outline
3) Code completion
to work with the new language (I have the part of keyword highlighting
already working).

The problem is that the language I’m working with has no declaration
and type sections that are presented in C99. Bellow are the rules that
bypass the declaration and type rules as I’ve defined:

119  172   directive ::= align_directive               (NEW)
120  173   directive ::= ds_directive                  (NEW)
121  174   directive ::= dcb_directive                (NEW)
122  175   directive ::= dcw_directive                (NEW)
123  176   directive ::= dcl_directive                 (NEW)
124  177   directive ::= list_directive                 (NEW)
125  178   directive ::= nolist_directive              (NEW)
126  179   directive ::= global_directive             (NEW)
127  180   directive ::= const_directive              (NEW)
128  181   directive ::= register_directive           (NEW)
129  182   directive ::= reserve_directive            (NEW)
130  183   directive ::= strict_directive               (NEW)
131  184   directive ::= nonstrict_directive         (NEW)
132  185   directive ::= sync_directive               (NEW)
133  186   directive ::= nosync_directive            (NEW)
134  187   directive ::= functioncall_attr             (NEW)
135  188   directive ::= func_declarator              (NEW)
136  189   directive ::= outofline_directive           (NEW)
137  190   directive ::= struct_or_union_specifier (NEW)
138  191   directive ::= enum_specifier               (NEW)

139  93    expression_statement ::= ;
140  94    expression_statement ::= expression_in_statement ;
141  154   expression_statement ::= directive ;   (NEW)

158  213   section_definition ::= SectionDirective identifier_token
compound_statement  (NEW)

159  79    statement ::= labeled_statement
160  80    statement ::= compound_statement
161  81    statement ::= expression_statement
162  82    statement ::= selection_statement
163  83    statement ::= iteration_statement
164  84    statement ::= jump_statement
165  149   statement ::= include_directive              (NEW)
166  150   statement ::= inline_func_definition        (NEW)
167  151   statement ::= func_definition                 (NEW)
168  152   statement ::= section_definition             (NEW)
169  153   statement ::= ERROR_TOKEN

170  92    block_item ::= statement                       (NEW)
171  90    block_item_list ::= block_item
172  91    block_item_list ::= block_item_list block_item

173  211   translation_unit ::= block_item_list
174  212   translation_unit ::=
175  0     $accept ::= translation_unit
176  2     <empty> ::=



Hence, one of the problems I have is how to override the
BuildASTParserAction#consumeTranslationUnit method  to add/get
statements to the TranslationUnit instead of
addDeclarations/getDeclaration methods (the problem is that
INodeFactory is annotated by @noextend, @noimplement).

How to overcome this?
Thank you,
David


On Tue, Sep 15, 2009 at 5:52 PM, Charley Wang <charley.wang@xxxxxxxxx> wrote:
> Hi,
>
> I'm trying to test a plugin and one of the functions I'd like to test needs
> an IBinary.
>
> Within the plugin itself I can use
>
> CCorePlugin.getDefault().getCoreModel().create(path).getCProject().getBinaryContainer().getBinaries();
>
> to get the binaries, but when executing as a JUnit Plugin-test this results
> in Null Pointer Exceptions. After some poking around, I know it's the
> create(path) function that's returning null, and I'm not sure why.
>
> Does anybody know why this line works in the regular plugin but not as a
> plugin test? [And/or does anybody have any suggestions on how to fix this?]
>
> Thank you!
> -Charley
>
>
>
> _______________________________________________
> cdt-dev mailing list
> cdt-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/cdt-dev
>
>


Back to the top