Bug 140788 - Having square brackets in the names of data objects, scalars, etc. can bork parsing.
Summary: Having square brackets in the names of data objects, scalars, etc. can bork p...
Status: RESOLVED FIXED
Alias: None
Product: kst
Classification: Applications
Component: general (show other bugs)
Version: 1.x
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: kst
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-01-28 20:08 UTC by Duncan Hanson
Modified: 2008-09-04 23:24 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Duncan Hanson 2007-01-28 20:08:05 UTC
Version:            (using KDE KDE 3.5.5)

The parser fails when the string which it is parsing has double square brackets (eg. [[), so if there are square brackets in the unique name of a data object or scalar which you are trying to include in a label or equation string, it probably won't work.

Maybe we should exclude square brackets from this list of characters allowed in unique names? We'll probably also have to change the way in which matrices are input, because I believe that right now they require [ ] brackets for the column title describing the matrix.

Duncan.
Comment 1 George Staikos 2007-01-28 20:20:18 UTC
You should be able to escape them with \
--
George Staikos
KDE Developer				http://www.kde.org/
Staikos Computing Services Inc.		http://www.staikos.net/
Comment 2 Duncan Hanson 2007-01-29 08:34:38 UTC
... or just as easily I could rename my objects not to include [ ]--
the problem is really for people who are less familiar with Kst and
can't figure out why their labels don't work.

Duncan.

On 28 Jan 2007 19:20:19 -0000, George Staikos <staikos@kde.org> wrote:
[bugs.kde.org quoted mail]
Comment 3 George Staikos 2007-01-29 08:46:46 UTC
... if the brackets can be escaped, what else can be done?  The  
square bracket is a reserved character.
--
George Staikos
KDE Developer				http://www.kde.org/
Staikos Computing Services Inc.		http://www.staikos.net/
Comment 4 Netterfield 2007-03-31 00:40:54 UTC
SVN commit 648296 by netterfield:

CCBUG: 140788   

Improve tool tip documentation for [], but [ in tag names still doesn't
work in labels (at least I can't get it to....)



 M  +1 -1      viewlabelwidget.ui.h  


--- trunk/extragear/graphics/kst/src/libkstapp/viewlabelwidget.ui.h #648295:648296
@@ -25,7 +25,7 @@
     connect(_strings, SIGNAL(selectionChanged(const QString &)),
 	    this, SLOT(insertStringInText(const QString &)));
 
-    QWhatsThis::add(_text, i18n("<qt>The syntax for labels is a derivative of a subset of LaTeX.  Supported syntax is: <b>\\[greeklettername]</b> and <b>\\[Greeklettername]</b>, <b>\\approx</b>, <b>\\cdot</b>, <b>\\ge</b>, <b>\\geq</b>, <b>\\inf</b>, <b>\\int</b>, <b>\\le</b>, <b>\\leq</b>, <b>\\ne</b>, <b>\\n</b>, <b>\\partial</b>, <b>\\prod</b>, <b>\\pm</b>, <b>\\textcolor{color name}{colored text}</b>, <b>\\textbf{bold text}</b>, <b>\\textit{italicized text}</b>, <b>\\t</b>, <b>\\sum</b>, <b>\\sqrt</b>, <b>\\underline{underlined text}</b>, <b>x^y</b>, <b>x_y</b>.  Data references and embedded expressions should be enclosed in square brackets.  Example: <i>[=[MyScalar]/2]</i>"));
+    QWhatsThis::add(_text, i18n("<qt>The syntax for labels is a derivative of a subset of LaTeX.  Supported syntax is: <b>\\[greeklettername]</b> and <b>\\[Greeklettername]</b>, <b>\\approx</b>, <b>\\cdot</b>, <b>\\ge</b>, <b>\\geq</b>, <b>\\inf</b>, <b>\\int</b>, <b>\\le</b>, <b>\\leq</b>, <b>\\ne</b>, <b>\\n</b>, <b>\\partial</b>, <b>\\prod</b>, <b>\\pm</b>, <b>\\textcolor{color name}{colored text}</b>, <b>\\textbf{bold text}</b>, <b>\\textit{italicized text}</b>, <b>\\t</b>, <b>\\sum</b>, <b>\\sqrt</b>, <b>\\underline{underlined text}</b>, <b>x^y</b>, <b>x_y</b>.  Scalars, equations, and vector elements can be embedded.  Scalar: <i>[V1/Mean]</i>.  Vector Element: <i>[V1[4]]</i>.  Equation: <i>[=[V1/Mean]^2]</i>.  A [ character can be inserted as <i>\\[</i>."));
 }
 
 
Comment 5 Andrew Walker 2007-06-22 20:33:16 UTC
The problem is that the code handling the embedded data objects fails when there are square brackets in the name. The square brackets cannot be escaped (as suggested by George) as the code does not recognise the escape character within the name - which is why Barth cannot get tag names with [ to work in labels.

The solution is to write a more intelligent parser for embedded data objects or to disallow [] in the names. The latter seems simpler and we can continue to support existing data object names with [] (but they won't work in labels just as at present).

Comment 6 Andrew Walker 2007-06-22 20:35:12 UTC
The relevant section of code is at case '[': in parseInternal(...) in labelparser.cpp
Comment 7 Andrew Walker 2008-09-04 23:24:14 UTC
The square brackets are now removed from vector and scalar names prior to their creation. Due to the need for backward compatibility this is not a complete solution, but helps to solve the problem for newly created sessions. This is probably as far as it can go.

Files changed (the new version of the SVN server no longer appears to be accepting BUG and CCBUG):

kstvectordialog_i.cpp
scalarselector.ui.h