public class CheaderParser
extends java.lang.Object
Cheader.zbnf in the software component
www.vishia.org/ZBNF/zbnfjax.
public static class Subclasses which are the complements to the parsers result component.
The structure of the syntax of a header file may be able to recognized with them. See the syntax definition.
CheaderParser.ZbnfResultFile. This class contains new_... and add_.. methods
for the parser's result components of the header file.
CheaderParser.ZbnfResultData which is returned by the execute(Args) method of this class.
##A ZZcmd script:
sub ExampleGen(Obj target: org.vishia.cmd.ZmakeTarget) ##a zmake target
{
Obj headerTranslator = java new org.vishia.header2Reflection.CheaderParser(console); ##create instance of this class
Obj args = java new org.vishia.header2Reflection.CheaderParser$Args(); ##arguments have to be filled firstly
List inputsExpanded = target.allInputFilesExpanded();
for(input:inputsExpanded)
{ args.addSrc(input.absfile(), input.namext()); ##input files, here from zmake target.
}
args.setDst(target.output.absfile()); ##the output file
args.setZbnfHeader(<:><&scriptdir>/../../zbnfjax/zbnf/Cheader.zbnf<.>); ##the Zbnf syntax control script.
//
Obj headers = headerTranslator.execute(args); ##executes
The result tree headers is contained in the instance of CheaderParser.ZbnfResultData. That result can be evaluated with JZcmd for example:
##A ZZcmd script:
for(headerfile: headers.files){
for(classC: headerfile.listClassC) {
for(entry: classC.entries) {
if(entry.whatisit == "structDefinition") {
call genStruct(struct=entry, headerName = &headerfile.fileName);
}
}
}
}
For Zmake see www.vishia.org/ZBNF/sf/docu/Zmake.html.
JZtxtcmd,
JZtxtcmdExecuter| Modifier and Type | Field and Description |
|---|---|
(package private) static java.util.Map<java.lang.String,CheaderParser.StructOrClassDef> |
allClasses
All yet parsed struct or class.
|
private MainCmd_ifc |
console |
static java.lang.String |
sVersion
Version, history and license.
|
| Constructor and Description |
|---|
CheaderParser(MainCmd_ifc console) |
| Modifier and Type | Method and Description |
|---|---|
CheaderParser.ZbnfResultData |
execute(CheaderParser.Args args) |
private CheaderParser.ZbnfResultData |
parseAndStoreInput(CheaderParser.Args args)
This method reads the input script, parses it with ZBNF,
stores all results in the Java-class
CheaderParser.ZbnfResultData |
static java.lang.String |
prepareReflName(java.lang.String name)
Prepares a name for a variable, may be longer than 30 chars or may contain "." for sub structure.
|
public static final java.lang.String sVersion
CheaderParser.StructDefinition.new_attribMacro(), the HeaderBlock.add_macro is removed. It is more systematic. Cheader.zbnf adequate changed.
struct TYPE_t{....} TYPE_s; class TYPE : TYPE_s{...}; reflection_TYPE
The reflection_TYPE is for a struct TYPE_s which is presented by a class TYPE without own reflection.
StructDefinition#add_attribute(AttributeOrTypedef)
structNameTypeOffs removed, see StructDefinition#add_innerStructAttribute(StructDefinition)
CheaderParser.HeaderBlock.set_const(), CheaderParser.HeaderBlock.new_structContentInsideCondition() should return a CheaderParser.ConditionBlock.
HeaderBlock#add_macro(AttribAsMacro) and StructDefinition#add_macro(AttribAsMacro): The OS_HandlePtr should be accepted as attribute.
Some more container for semantics from CHeader.zbnf
CheaderParser.StructDefinition with attributes and isBasedOnObjectJc. Used for Sfunction not based on ObjectJc.
CheaderParser.Type.pointer_ with CheaderParser.Pointer designation
CheaderParser.StructDefinition is used for CheaderParser.HeaderBlock.new_undefDefinition() instead the older extra class UnionVariante.
the CheaderParser.StructDefinition.isUnion designates that it is a union in semantic. Using scripts should be changed.
Some new definitions StructDefinition#set_innerUnion() and StructDefinition#set_innerStruct() are added.
CmdHeader2Reflection,
or the generation of some things are done via the XML output from the parser via an XSLT translator.
static java.util.Map<java.lang.String,CheaderParser.StructOrClassDef> allClasses
private final MainCmd_ifc console
public CheaderParser(MainCmd_ifc console)
public CheaderParser.ZbnfResultData execute(CheaderParser.Args args)
public static java.lang.String prepareReflName(java.lang.String name)
name - private CheaderParser.ZbnfResultData parseAndStoreInput(CheaderParser.Args args)
CheaderParser.ZbnfResultData