diff --git a/Project.toml b/Project.toml index 6e5f1fc4..cb514963 100644 --- a/Project.toml +++ b/Project.toml @@ -1,6 +1,6 @@ name = "PSRClassesInterface" uuid = "1eab49e5-27d8-4905-b9f6-327b6ea666c4" -version = "0.15.0" +version = "0.16.0" [deps] DBInterface = "a10d1c49-ce27-4219-8d33-6db1a4562965" diff --git a/src/PMD/parser/parser.jl b/src/PMD/parser/parser.jl index 3cace1ef..22e3ade1 100644 --- a/src/PMD/parser/parser.jl +++ b/src/PMD/parser/parser.jl @@ -181,6 +181,16 @@ function _apply_tag!( parser, "Unhandled '$tag' tag for '$(attribute)' within '$(collection)' definition", ) + elseif tag == "@addyear_modification" + _warning( + parser, + "Unhandled '$tag' tag for '$(attribute)' within '$(collection)' definition", + ) + elseif tag == "@addyear_chronological" + _warning( + parser, + "Unhandled '$tag' tag for '$(attribute)' within '$(collection)' definition", + ) else _syntax_error( parser, @@ -612,7 +622,7 @@ function _parse_attribute!( state::S, ) where {S <: Union{PMD_DEF_MODEL, PMD_DEF_CLASS, PMD_MERGE_CLASS}} m = match( - r"(PARM|VECTOR|VETOR)\s+(INTEGER|REAL|DATE|STRING)\s+(\S+)(\s+DIM\((\S+(,\S+)*)\))?(\s+INDEX\s+(\S+))?(\s+(\@\S+))?", + r"(PARM|VECTOR|VETOR)\s+(INTEGER|REAL|DATE|STRING)\s+(\S+)(\s+DIM\((\S+(,\S+)*)\))?(\s+INDEX\s+(\S+))?((\s+(\@\S+))+)?", line, ) @@ -622,7 +632,7 @@ function _parse_attribute!( name = m[3] dims = m[5] index = m[8] - tag = m[10] + tags = m[9] if haskey(parser.data_struct[state.collection], name) if PMD._is_vector(kind) != parser.data_struct[state.collection][name].is_vector @@ -665,8 +675,12 @@ function _parse_attribute!( (index === nothing) ? "" : index, ) - if tag !== nothing - _apply_tag!(parser, state.collection, name, tag) + if tags !== nothing + for tag in split(strip(tags), " ") + if !isempty(tag) + _apply_tag!(parser, state.collection, name, tag) + end + end end return true diff --git a/test/data/pmd/source3.pmd b/test/data/pmd/source3.pmd index 4d89ffd6..5c0fc653 100644 --- a/test/data/pmd/source3.pmd +++ b/test/data/pmd/source3.pmd @@ -17,6 +17,7 @@ DEFINE_CLASS PSRBus END_CLASS DEFINE_CLASS PSRElement + VETOR DATE Data @addyear_modification PARM INTEGER NumberUnits PARM INTEGER Code @id END_CLASS @@ -28,7 +29,7 @@ DEFINE_CLASS PSRGeneratorUnit PARM REFERENCE Bus PSRBus VECTOR REFERENCE Buses PSRBus VECTOR REFERENCE Element PSRElement - VETOR DATE Date @chronological + VETOR DATE Date @chronological @addyear_chronological END_CLASS DEFINE_MODEL PSRTest diff --git a/test/pmd_parser.jl b/test/pmd_parser.jl index d2ca13b6..6b938fc5 100644 --- a/test/pmd_parser.jl +++ b/test/pmd_parser.jl @@ -370,6 +370,8 @@ function test_pmd_source_3() PSRI.PMD.Attribute("name", false, String, 0, ""), "Code" => PSRI.PMD.Attribute("Code", false, Int32, 0, ""), + "Data" => + PSRI.PMD.Attribute("Data", true, Dates.Date, 0, ""), "code" => PSRI.PMD.Attribute("code", false, Int32, 0, ""), "NumberUnits" => PSRI.PMD.Attribute(