jp-embedded / scxmlcc

The SCXML state machine to C++ compiler
GNU General Public License v3.0
138 stars 34 forks source link

Error on empty <raise> #93

Closed sstiller closed 5 years ago

sstiller commented 5 years ago

If empty <raise/> actions exist in the document, scxmlcc gives up: error: parse_raise: No such node (<xmlattr>) The same problem seems to exist for other elements, too. See also #62

Example:

<?xml version="1.0" encoding="UTF-8"?>
<scxml xmlns="http://www.w3.org/2005/07/scxml" version="1.0" binding="early" name="raise_err" initial="State_1">
    <state id="State_1">
        <onentry>
            <raise/>
        </onentry>
    </state>
</scxml>
jp-embedded commented 5 years ago

Well, an empty raise is not allowed, since the event attribute is required. Ref https://www.w3.org/TR/scxml/#raise

So I guess it is okay that the parser aborts because it is an error in the document. But of course the error message could be better.

What do you think?

sstiller commented 5 years ago

You are right, I didn't check the standard. Better messages are really useful (I needed to look into the scxmlcc source code to find the reason). Like in #62 it happens when using the Qt Creator.

jp-embedded commented 5 years ago

Hmm. If qt creates such 'raise's, maybe it would be better to make it a warning instead.

sstiller commented 5 years ago

It can be fixed using the qt creator. A warning is not really necessary.

jp-embedded commented 5 years ago

fixed with a meaningful error message