Skip to content

Commit

Permalink
Fix parsing IDL oneway operations (#147)
Browse files Browse the repository at this point in the history
Signed-off-by: Ricardo González Moreno <ricardo@richiware.dev>
  • Loading branch information
richiware authored Jul 3, 2024
1 parent f1bc6cd commit 31e6519
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
3 changes: 2 additions & 1 deletion src/main/antlr/com/eprosima/idl/parser/grammar/IDL.g4
Original file line number Diff line number Diff line change
Expand Up @@ -2320,7 +2320,8 @@ op_decl [Vector<Annotation> annotations] returns [Pair<Operation, TemplateGroup>
Vector<Pair<String, Token>> exceptions = null;
}
: ( op_attribute { tkoneway=$op_attribute.token; } )?
op_type_spec { retType=$op_type_spec.returnPair.first(); template=$op_type_spec.returnPair.second();}
op_type_spec { if(null != $op_type_spec.returnPair) {retType=$op_type_spec.returnPair.first();
template=$op_type_spec.returnPair.second();}}
{
tk = _input.LT(1);
name += tk.getText();
Expand Down
23 changes: 11 additions & 12 deletions src/main/java/com/eprosima/idl/context/Context.java
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,6 @@ public Context(
m_file = m_file.substring(m_directoryFile.length());
*/

m_definitions = new ArrayList<Definition>();
m_modules = new HashMap<String, com.eprosima.idl.parser.tree.Module>();
m_interfaces = new HashMap<String, Interface>();
m_exceptions = new HashMap<String, com.eprosima.idl.parser.tree.Exception>();
m_types = new HashMap<String, TypeDeclaration>();
m_annotations = new HashMap<String, AnnotationDeclaration>();
m_keywords = new HashSet<String>();
fillKeywords();

Expand Down Expand Up @@ -795,6 +789,11 @@ public BitfieldSpec createBitfieldSpec(
return object;
}

public Collection<com.eprosima.idl.parser.tree.Exception> getExceptions()
{
return m_exceptions.values();
}

public Collection<TypeDeclaration> getTypes()
{
return m_types.values();
Expand Down Expand Up @@ -1538,17 +1537,17 @@ public boolean is_enabled_custom_property_in_current_group(String custom_propert
final String includeFlag = "-I";

//! Store all global definitions.
private ArrayList<Definition> m_definitions;
private ArrayList<Definition> m_definitions = new ArrayList<Definition>();
//! Map that contains all modules that were found processing the IDL file (after preprocessing):
private HashMap<String, com.eprosima.idl.parser.tree.Module> m_modules = null;
private HashMap<String, com.eprosima.idl.parser.tree.Module> m_modules = new HashMap<String, com.eprosima.idl.parser.tree.Module>();
//! Map that contains all interfaces that were found processing the IDL file (after preprocessing):
private HashMap<String, Interface> m_interfaces = null;
private HashMap<String, Interface> m_interfaces = new HashMap<String, Interface>();
//! Map that contains all global exceptions that were found processing the IDL file (after preprocessing).
private HashMap<String, com.eprosima.idl.parser.tree.Exception> m_exceptions = null;
private HashMap<String, com.eprosima.idl.parser.tree.Exception> m_exceptions = new HashMap<String, com.eprosima.idl.parser.tree.Exception>();
//! Map that contains all types that were found processing the IDL file (after preprocessing).
protected HashMap<String, TypeDeclaration> m_types = null;
private HashMap<String, TypeDeclaration> m_types = new HashMap<String, TypeDeclaration>();
//! Map that contains all annotations that where found processing the IDL file.
private HashMap<String, AnnotationDeclaration> m_annotations = null;
private HashMap<String, AnnotationDeclaration> m_annotations = new HashMap<String, AnnotationDeclaration>();

private ArrayList<String> m_includePaths = null;
//! Set that contains the library dependencies that were found because there was a line of the preprocessor.
Expand Down

0 comments on commit 31e6519

Please sign in to comment.