parser for an ecf file?

21 views
Skip to first unread message

Jimmy Johnson

unread,
Apr 15, 2015, 1:16:47 AM4/15/15
to eiffelst...@googlegroups.com
Is there a stand-alone parser for an ecf file?  If so does it build an AST?

Is there a round-trip visitor for an ecf file that allows an ecf file to be parsed and then printed (with modifications)?

Thanks,
jjj

Jocelyn Fiat

unread,
Apr 15, 2015, 1:59:53 AM4/15/15
to eiffelst...@googlegroups.com
See https://svn.eiffel.com/eiffelstudio/trunk/Src/framework/configuration/parser
It does not generate any AST.
However ecf syntax is XML, so this is easy to parse, for the semantic check the CONF_ classes.
You can have a look at https://svn.eiffel.com/eiffelstudio/trunk/Src/tools/ecf_tool which is a tool with various commands related to ecf manipulations.

For instance https://svn.eiffel.com/eiffelstudio/trunk/Src/tools/ecf_tool/src/commands/resave/ is to open an ecf and resave it using a printer.

Note that it does not keep commented lines.

Regards,
-- Jocelyn

--
For more messaging options, visit this group at http://forum.eiffel.com.
Information on the Eiffelstudio project: http://dev.eiffel.com.

Jimmy Johnson

unread,
Apr 16, 2015, 2:53:02 PM4/16/15
to eiffelst...@googlegroups.com
Thanks Jocelyn,

I have compiled and studied the tool.  It looks like a good place to start for what I need.

By the way, I am getting a developer error raised in `process_system_attributes' from CONF_LOAD_PARSE_CALLBACKS.  It is a CONF_ERROR_UUID.  When traced `is_valid_uuid' returns false.  The debugger, though, shows the UUID which is valid.  In `is_valid_uuid' the call to a_uuid.item (i) in the debugger watch list gives  51 '3' for "Value" (Then number 3 is the first character of the UUID.)  But in the line "Result := a_uuid.item (i).is_hexa_digit" the debugger shows the current object (i.e. a_uuid.item (1)) to be 0 '%U' when I expect it to be 3.  Any idea what is going on?

I'm on a Mac, have sometimes used Textedit to edit the ecf file and saved as plain text.

Thanks,
jjj

Jimmy Johnson

unread,
Apr 18, 2015, 8:15:59 AM4/18/15
to eiffelst...@googlegroups.com
Jocelyn,

I fixed the UUID problem by converting the CHARACTER_32 `to_character_8'.

Now, on a system that compiles with 15.01, the `resave' option of the ecf_tool raises a "Parse error".  In `consume_type' from CLASS_TYPE_NAME_SYNTAX_CHECKER, the `current_parsed_string' is the name of my root class in lower case, but the `current_token' is 7, which is `tkn_error'.  Any idea why it is not `tin_id'?  Where could the value have been set to tkn_error?

Thanks,
jjj

Jimmy Johnson

unread,
Apr 20, 2015, 4:09:51 PM4/20/15
to eiffelst...@googlegroups.com
I have the system working for the "resave" option, but after studying the code, I am still unsure how to adapt it for my use.  I want to read an ecf file and from it create a new ecf with a new name identical to the first except with the following changes,
for each library (and cluster) name:  prepend each subdirectory name with a prefix such as
     <library name="test" location = "$JJ_SOURCE\persistence\tools\test_other\test_other.ecf"/>
becomes
     <library name="pp_test" location = $PP_JJ_SOURCE\pp_persistence\pp_tools\pp_test_other\pp_test_other.ecf"/>

I cannot find the point in the code where the location's name can be changed/printed.  I thought maybe `all_libraries' from CONF_SYSTEM, but that table remains empty as the system runs.

Can you point me in the right direction?  

Also, this does not seem to explore ecf files mentioned within the parsed ecf, is that correct?

Thanks,
jjj


On Wednesday, April 15, 2015 at 1:59:53 AM UTC-4, Jocelyn Fiat wrote:
Reply all
Reply to author
Forward
0 new messages