ETSI's Bug Tracker - Part 01: TTCN-3 Core Language
View Issue Details

ID | Project | Category | View Status | Date Submitted | Last Update
0005805 | Part 01: TTCN-3 Core Language | Technical | public | 11-11-2010 13:46 | 01-07-2011 14:42

Reporter | Jacob Wieland - Spirent |
Assigned To | Ina Schieferdecker |
Priority | high | Severity | minor | Reproducibility | have not tried
Status | closed | Resolution | fixed |
Platform |  | OS |  | OS Version |
Product Version |  |
Target Version | v4.3.2 (interim 2011) | Fixed in Version | v4.3.2 (interim 2011) |
Clause Reference(s) | B.1.5.2, A.1.6.1.3
Source (company - Author) | Testing Technologies - Jacob Wieland

Summary | 0005805: BNF rule for PatternElement is ambiguous, Example is wrong

Description

In the rule for PatternElement in the BNF, the last branch (PatternChar) creates an ambiguity as that can be any char and thus, every Pattern can be derived to a sequence of PatternChar, even those that should be derived by using the other alternatives in PatternElement.
Especially for those PatternElement constructs which contain more than one character, this leads to unresolvable problems (if the ambiguity is not removed somehow).
I guess the intention was that PatternChar should be any character which is not one of the characters in the "first set" of the other alternatives in PatternElement. Thus, the following characters need to be excluded "\", "?", "*", "|", "+", "[", "{", """ and "#"
Consequently, I think that the example in B.1.5.2
template charstring RegExp4 := pattern "{Reg";
should be changed to
template charstring RegExp4 := pattern "\{Reg";
Finally, it should be forbidden to use reference expressions in referenced variables/parameters/module parameters (i.e. all entities which are unknown at compile time). I.e. if a referenced charstring value contains a reference-like expression, it is treated as if it was just the sequence of the characters of the reference. Meaning: if I have a variable v which contains "{a}", then referencing it via pattern "{v}" will match only the charstring "{a}" and not any referenced 'a'. If this is the intention of the standard anyway, then it needs to be clarified.
Consequently, the stuff in EXAMPLE 3 (which is wrong in any case as it is missing at least one 'pattern') should be forbidden. But, maybe there are only some typos in Ref6, where Ref1 should be Ref4 and Ref2 should be Ref5.
I guess what the example was really supposed to be was this:
template charstring Ref0:= "My String";
template charstring Ref1:= "{Re";
template charstring Ref2:= "f0}";
template charstring Ref3:= pattern "{Ref1}{Ref2}";
//this matches "{Ref0}"
//i.e. there is no further dereferencing
//as Ref1 and Ref2 do not contain a reference
template charstring Ref4:= pattern "{Ref0}";
template charstring Ref5:= "";
template charstring Ref6:= pattern "{Ref4}{Ref5}";
//this matches "My String" â€“ here Ref0 is dereferenced, because Ref4 contains
//the reference expression {Ref0} with the reference Ref0
template charstring RegExp7 := pattern "{Reg" & "Exp1}";
//note the difference to Ref6: in this case the fragments of the
//pattern are joined before any evaluation, i.e. this template will match the string "ab"

Steps To Reproduce |
Additional Information |
Tags | No tags attached.

Relationships

parent of | 0005835 | closed | Ina Schieferdecker | BNF rule for PatternElement is ambiguous, Example is wrong
related to | 0005797 | closed | Ina Schieferdecker | BNF for CharStringMatch is inconsistent with description
related to | 0005828 | closed | Ina Schieferdecker | STF409 comment on [Part 1: TTCN-3 Core Language /Annex B.1.5.2 ]: syntactical ambiguity
related to | 0006169 | closed | Ina Schieferdecker | The pattern char grammar has been mixed up

Attached Files | core.bnf (57,081) 30-06-2011 17:21 http://oldforge.etsi.org/mantis/file_download.php?file_id=2540&type=bug

Issue History
Date Modified | Username | Field | Change
11-11-2010 13:46 | Jacob Wieland - Spirent | New Issue |
11-11-2010 13:46 | Jacob Wieland - Spirent | Clause Reference(s) | => B.1.5.2, A.1.6.1.3
11-11-2010 13:46 | Jacob Wieland - Spirent | Source (company - Author) | => Testing Technologies - Jacob Wieland
24-11-2010 15:33 | Gyorgy Rethy | Note Added: 0009799 |
24-11-2010 15:34 | Gyorgy Rethy | Note Added: 0009800 |
29-11-2010 15:45 | Jacob Wieland - Spirent | Description Updated |
29-11-2010 15:53 | Jacob Wieland - Spirent | Relationship added | related to 0005797
29-11-2010 15:53 | Jacob Wieland - Spirent | Relationship added | related to 0005828
30-11-2010 09:35 | Ina Schieferdecker | Project | TTCN-3 Change Requests => Part 01: TTCN-3 Core Language
30-11-2010 17:11 | Gyorgy Rethy | Note Added: 0009868 |
30-11-2010 17:11 | Gyorgy Rethy | Assigned To | => Ina Schieferdecker
30-11-2010 17:11 | Gyorgy Rethy | Status | new => assigned
30-11-2010 17:12 | Gyorgy Rethy | Issue cloned: 0005835 |
30-11-2010 17:12 | Gyorgy Rethy | Relationship added | parent of 0005835
01-12-2010 16:47 | Ina Schieferdecker | Note Added: 0009905 |
01-12-2010 16:47 | Ina Schieferdecker | Target Version | => Edition 4.3.1 (not yet published)
01-12-2010 16:49 | Ina Schieferdecker | Note Edited: 0009905 |
03-12-2010 10:06 | Gyorgy Rethy | Target Version | Edition 4.3.1 (not yet published) => Edition 4.3.2 (interim)
20-05-2011 13:09 | Gyorgy Rethy | Note Deleted: 0009800 |
24-05-2011 16:02 | Gyorgy Rethy | Note Added: 0010033 |
24-05-2011 16:02 | Gyorgy Rethy | Assigned To | Ina Schieferdecker => Jacob Wieland - Spirent
24-05-2011 19:30 | Gyorgy Rethy | Priority | normal => high
25-05-2011 09:05 | Jacob Wieland - Spirent | Note Added: 0010043 |
25-05-2011 17:32 | Jacob Wieland - Spirent | Assigned To | Jacob Wieland - Spirent => Ina Schieferdecker
26-05-2011 12:58 | Jacob Wieland - Spirent | File Added: core.bnf |
26-05-2011 12:59 | Jacob Wieland - Spirent | Note Added: 0010085 |
30-06-2011 17:20 | Ina Schieferdecker | Note Added: 0010166 |
30-06-2011 17:21 | Ina Schieferdecker | File Deleted: core.bnf |
30-06-2011 17:21 | Ina Schieferdecker | File Added: core.bnf |
01-07-2011 14:41 | Ina Schieferdecker | Status | assigned => resolved
01-07-2011 14:41 | Ina Schieferdecker | Fixed in Version | => Edition 4.3.2 (interim)
01-07-2011 14:41 | Ina Schieferdecker | Resolution | open => fixed
01-07-2011 14:42 | Ina Schieferdecker | Status | resolved => closed
10-07-2012 18:01 | Ina Schieferdecker | Relationship added | related to 0006169

Notes

(0009799)
Gyorgy Rethy
24-11-2010 15:33

We should discuss if pattern syntax shall be handled in the BNF at all; patterns are "just strings" with special semantics (i.e. pattern "abc?" and pattern "abc\?" - both correct, just semantically means different things).
Your comment to Example 3 is correct, I think Ref6 shall also be a pattern:
template charstring Ref6:= pattern "{Ref4}{Ref5}";
otherwise Ref6 is not de-referenced, just processed as a simple string.

(0009868)
Gyorgy Rethy
30-11-2010 17:11

STF discussion 30-11-2010: correct the examples in v4.3.1. More detailed discussion is postponed to 2011.

(0009905)
Ina Schieferdecker
01-12-2010 16:47 (edited on: 01-12-2010 16:49)

Example corrected via CR5835. Further discussions then in 2011.

(0010033)
Gyorgy Rethy
24-05-2011 16:02

Replace PatternChar production with a definition excluding the leading pattern characters.

(0010043)
Jacob Wieland - Spirent
25-05-2011 09:05

The grammar should be changed in the following way:
108. CharStringMatch ::= PatternKeyword PatternParticle {"&" PatternParticle }
109. PatternParticle ::= Pattern | ReferencedValue
110. PatternKeyword ::= "pattern"
111. Pattern ::= """ {PatternElement} """
112. PatternElement ::= ("\" ("?" | "*" | "\" | "[" | "]" | "{" | "}" |
""" | "|" | "(" | ")" | "#" | "+" | "d" |
"w" | "t" | "n" | "r" | "s" | "b")) |
("?" | "*" | "|" | "+") |
("[" ["^"] {PatternClassChar ["-" PatternClassChar]} "]") |
("{" ReferencedValue "}") |
("\" "N" "{" (ReferencedValue | Type) "}") |
(""" """) |
("(" PatternElement ")") |
("#" (Num |
("(" Num "," [Num] ")") | ("(" "," Num ")"))) |
PatternChar
113. PatternChar ::= NonSpecialPatternChar | PatternQuadruple
NonSpecialPatternChar ::= Char
/* STATIC SEMANTICS: NonSpecialPatternChar shall not be one of the following characters: "\", "?", "*", "|", "+", "[", "{", """, "(", "#"
*/
PatternClassChar ::= NonSpecialPatternClassChar |
PatternQuadruple |
"\" EscapedPatternClassChar
NonSpecialPatternClassChar ::= Char
/* STATIC SEMANTICS: NonSpecialPatternClassChar shall not be one of the following characters: "-", "^", "]"
*/
EscapedPatternClassChar ::= Char
/* STATIC SEMANTICS: EscapedPatternClassChar shall not be one of the following characters: "q"
*/
114. PatternQuadruple ::= "\" "q" "(" Number "," Number "," Number "," Number ")"
The rules for NonSpecialPatternChar, PatternClassChar, NonSpecialPatternClassChar and EscapedPatternClassChar are new and reflect the restrictions on the characters in the contexts they appear in, i.e. they exclude all characters that have special meaning in those contexts.

(0010085)
Jacob Wieland - Spirent
26-05-2011 12:59

added changed grammar

(0010166)
Ina Schieferdecker
30-06-2011 17:20

This was not quite the latest BNF ... see uploaded BNF