]> git.lyx.org Git - lyx.git/blob - src/Lexer.cpp
More readable latex color (on button and workarea) in dark mode
[lyx.git] / src / Lexer.cpp
1 /**
2  * \file Lexer.cpp
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author Alejandro Aguilar Sierra
7  * \author Lars Gullik Bjønnes
8  * \author Jean-Marc Lasgouttes
9  * \author John Levon
10  *
11  * Full author contact details are available in file CREDITS.
12  */
13
14 #include <config.h>
15
16 #include "Lexer.h"
17 #include "Format.h"
18
19 #include "support/convert.h"
20 #include "support/debug.h"
21 #include "support/FileName.h"
22 #include "support/filetools.h"
23 #include "support/gzstream.h"
24 #include "support/lassert.h"
25 #include "support/lstrings.h"
26 #include "support/lyxalgo.h"
27
28 #include <algorithm> // sort, lower_bound
29 #include <functional>
30 #include <fstream>
31 #include <istream>
32 #include <stack>
33 #include <vector>
34
35 using namespace std;
36 using namespace lyx::support;
37
38 namespace lyx {
39
40 //////////////////////////////////////////////////////////////////////
41 //
42 // Lexer::Pimpl
43 //
44 //////////////////////////////////////////////////////////////////////
45
46
47 ///
48 class Lexer::Pimpl {
49 public:
50         ///
51         Pimpl(LexerKeyword * tab, int num);
52         ///
53         string const getString() const;
54         ///
55         docstring const getDocString() const;
56         ///
57         void printError(string const & message) const;
58         ///
59         void printTable(ostream & os);
60         ///
61         void pushTable(LexerKeyword * tab, int num);
62         ///
63         void popTable();
64         ///
65         bool setFile(FileName const & filename);
66         ///
67         void setStream(istream & i);
68         ///
69         void setCommentChar(char c);
70         ///
71         bool next(bool esc = false);
72         ///
73         int searchKeyword(char const * const tag) const;
74         ///
75         int lex();
76         ///
77         bool eatLine();
78         ///
79         bool nextToken();
80         /// test if there is a pushed token or the stream is ok
81         bool inputAvailable();
82         ///
83         void pushToken(string const &);
84         /// fb_ is only used to open files, the stream is accessed through is.
85         filebuf fb_;
86
87         /// gz_ is only used to open files, the stream is accessed through is.
88         gz::gzstreambuf gz_;
89
90         /// the stream that we use.
91         istream is;
92         ///
93         string name;
94         ///
95         LexerKeyword * table;
96         ///
97         int no_items;
98         ///
99         string buff;
100         ///
101         int status;
102         ///
103         int lineno;
104         ///
105         string pushTok;
106         /// used for error messages
107         string context;
108         ///
109         char commentChar;
110 private:
111         /// non-copyable
112         Pimpl(Pimpl const &);
113         void operator=(Pimpl const &);
114
115         ///
116         void verifyTable();
117         ///
118         class PushedTable {
119         public:
120                 ///
121                 PushedTable()
122                         : table_elem(nullptr), table_siz(0) {}
123                 ///
124                 PushedTable(LexerKeyword * ki, int siz)
125                         : table_elem(ki), table_siz(siz) {}
126                 ///
127                 LexerKeyword * table_elem;
128                 ///
129                 int table_siz;
130         };
131         ///
132         stack<PushedTable> pushed;
133 };
134
135
136 namespace {
137
138 // used by lower_bound, sort and sorted
139 bool compareTags(LexerKeyword const & a, LexerKeyword const & b)
140 {
141         // we use the ascii version, because in turkish, 'i'
142         // is not the lowercase version of 'I', and thus
143         // turkish locale breaks parsing of tags.
144         return compare_ascii_no_case(a.tag, b.tag) < 0;
145 }
146
147 } // namespace
148
149
150
151 Lexer::Pimpl::Pimpl(LexerKeyword * tab, int num)
152         : is(&fb_), table(tab), no_items(num),
153           status(0), lineno(0), commentChar('#')
154 {
155         verifyTable();
156 }
157
158
159 string const Lexer::Pimpl::getString() const
160 {
161         return buff;
162 }
163
164
165 docstring const Lexer::Pimpl::getDocString() const
166 {
167         return from_utf8(buff);
168 }
169
170
171 void Lexer::Pimpl::printError(string const & message) const
172 {
173         string const tmpmsg = subst(message, "$$Token", getString());
174         lyxerr << "LyX: " << tmpmsg << " [around line " << lineno
175                 << " of file " << to_utf8(makeDisplayPath(name))
176                 << " current token: '" << getString() << "'"
177                 << " context: '" << context << "']" << endl;
178 }
179
180
181 void Lexer::Pimpl::printTable(ostream & os)
182 {
183         os << "\nNumber of tags: " << no_items << endl;
184         for (int i= 0; i < no_items; ++i)
185                 os << "table[" << i
186                    << "]:  tag: `" << table[i].tag
187                    << "'  code:" << table[i].code << '\n';
188         os.flush();
189 }
190
191
192 void Lexer::Pimpl::verifyTable()
193 {
194         // Check if the table is sorted and if not, sort it.
195         if (table
196             && !lyx::sorted(table, table + no_items, &compareTags)) {
197                 lyxerr << "The table passed to Lexer is not sorted!\n"
198                        << "Tell the developers to fix it!" << endl;
199                 // We sort it anyway to avoid problems.
200                 lyxerr << "\nUnsorted:" << endl;
201                 printTable(lyxerr);
202
203                 sort(table, table + no_items, &compareTags);
204                 lyxerr << "\nSorted:" << endl;
205                 printTable(lyxerr);
206         }
207 }
208
209
210 void Lexer::Pimpl::pushTable(LexerKeyword * tab, int num)
211 {
212         PushedTable tmppu(table, no_items);
213         pushed.push(tmppu);
214
215         table = tab;
216         no_items = num;
217
218         verifyTable();
219 }
220
221
222 void Lexer::Pimpl::popTable()
223 {
224         if (pushed.empty()) {
225                 lyxerr << "Lexer error: nothing to pop!" << endl;
226                 return;
227         }
228
229         PushedTable tmp = pushed.top();
230         pushed.pop();
231         table = tmp.table_elem;
232         no_items = tmp.table_siz;
233 }
234
235
236 bool Lexer::Pimpl::setFile(FileName const & filename)
237 {
238         // Check the format of the file.
239         if (theFormats().isZippedFile(filename)) {
240                 LYXERR(Debug::LYXLEX, "lyxlex: compressed");
241                 // The check only outputs a debug message, because it triggers
242                 // a bug in compaq cxx 6.2, where is_open() returns 'true' for
243                 // a fresh new filebuf.  (JMarc)
244                 if (gz_.is_open() || istream::off_type(is.tellg()) > -1)
245                         LYXERR(Debug::LYXLEX, "Error in LyXLex::setFile: "
246                                 "file or stream already set.");
247                 gz_.open(filename.toFilesystemEncoding().c_str(), ios::in);
248                 is.rdbuf(&gz_);
249                 name = filename.absFileName();
250                 lineno = 0;
251                 if (!gz_.is_open() || !is.good())
252                         return false;
253         } else {
254                 LYXERR(Debug::LYXLEX, "lyxlex: UNcompressed");
255
256                 // The check only outputs a debug message, because it triggers
257                 // a bug in compaq cxx 6.2, where is_open() returns 'true' for
258                 // a fresh new filebuf.  (JMarc)
259                 if (fb_.is_open() || istream::off_type(is.tellg()) > 0) {
260                         LYXERR(Debug::LYXLEX, "Error in Lexer::setFile: "
261                                 "file or stream already set.");
262                 }
263                 fb_.open(filename.toSafeFilesystemEncoding().c_str(), ios::in);
264                 is.rdbuf(&fb_);
265                 name = filename.absFileName();
266                 lineno = 0;
267                 if (!fb_.is_open() || !is.good())
268                         return false;
269         }
270
271         // Skip byte order mark.
272         if (is.peek() == 0xef) {
273                 is.get();
274                 if (is.peek() == 0xbb) {
275                         is.get();
276                         LASSERT(is.get() == 0xbf, /**/);
277                 } else
278                         is.unget();
279         }
280
281         return true;
282 }
283
284
285 void Lexer::Pimpl::setStream(istream & i)
286 {
287         if (fb_.is_open() || istream::off_type(is.tellg()) > 0) {
288                 LYXERR(Debug::LYXLEX, "Error in Lexer::setStream: "
289                         "file or stream already set.");
290         }
291         is.rdbuf(i.rdbuf());
292         lineno = 0;
293 }
294
295
296 void Lexer::Pimpl::setCommentChar(char c)
297 {
298         commentChar = c;
299 }
300
301
302 bool Lexer::Pimpl::next(bool esc /* = false */)
303 {
304         if (!pushTok.empty()) {
305                 // There can have been a whole line pushed so
306                 // we extract the first word and leaves the rest
307                 // in pushTok. (Lgb)
308                 if (pushTok[0] == '\\' && pushTok.find(' ') != string::npos) {
309                         buff.clear();
310                         pushTok = split(pushTok, buff, ' ');
311                 } else {
312                         buff = pushTok;
313                         pushTok.clear();
314                 }
315                 status = LEX_TOKEN;
316                 return true;
317         }
318
319
320         char cc = 0;
321         status = 0;
322         while (is && !status) {
323                 is.get(cc);
324                 unsigned char c = cc;
325
326                 if (c == commentChar) {
327                         // Read rest of line (fast :-)
328 #if 1
329                         // That is not fast... (Lgb)
330                         string dummy;
331                         getline(is, dummy);
332
333                         LYXERR(Debug::LYXLEX, "Comment read: `" << c << dummy << '\'');
334 #else
335                         // unfortunately ignore is buggy (Lgb)
336                         is.ignore(100, '\n');
337 #endif
338                         ++lineno;
339                         continue;
340                 }
341
342                 if (c == '\"') {
343                         buff.clear();
344
345                         if (esc) {
346
347                                 do {
348                                         bool escaped = false;
349                                         is.get(cc);
350                                         c = cc;
351                                         if (c == '\r') continue;
352                                         if (c == '\\') {
353                                                 // escape the next char
354                                                 is.get(cc);
355                                                 c = cc;
356                                                 if (c == '\"' || c == '\\')
357                                                         escaped = true;
358                                                 else
359                                                         buff.push_back('\\');
360                                         }
361                                         buff.push_back(c);
362
363                                         if (!escaped && c == '\"')
364                                                 break;
365                                 } while (c != '\n' && is);
366
367                         } else {
368
369                                 do {
370                                         is.get(cc);
371                                         c = cc;
372                                         if (c != '\r')
373                                                 buff.push_back(c);
374                                 } while (c != '\"' && c != '\n' && is);
375
376                         }
377
378                         if (c != '\"') {
379                                 printError("Missing quote");
380                                 if (c == '\n')
381                                         ++lineno;
382                         }
383
384                         buff.resize(buff.size() - 1);
385                         status = LEX_DATA;
386                         break;
387                 }
388
389                 if (c == ',')
390                         continue;              /* Skip ','s */
391
392                 // using relational operators with chars other
393                 // than == and != is not safe. And if it is done
394                 // the type _have_ to be unsigned. It usually a
395                 // lot better to use the functions from cctype
396                 if (c > ' ' && is)  {
397                         buff.clear();
398
399                         do {
400                                 if (esc && c == '\\') {
401                                         // escape the next char
402                                         is.get(cc);
403                                         c = cc;
404                                         //escaped = true;
405                                 }
406                                 buff.push_back(c);
407                                 is.get(cc);
408                                 c = cc;
409                         } while (c > ' ' && c != ',' && is);
410                         status = LEX_TOKEN;
411                 }
412
413                 if (c == '\r' && is) {
414                         // The Windows support has lead to the
415                         // possibility of "\r\n" at the end of
416                         // a line.  This will stop LyX choking
417                         // when it expected to find a '\n'
418                         is.get(cc);
419                         c = cc;
420                 }
421
422                 if (c == '\n')
423                         ++lineno;
424
425         }
426         if (status)
427                 return true;
428
429         status = is.eof() ? LEX_FEOF: LEX_UNDEF;
430         buff.clear();
431         return false;
432 }
433
434
435 int Lexer::Pimpl::searchKeyword(char const * const tag) const
436 {
437         LexerKeyword search_tag = { tag, 0 };
438         LexerKeyword * res =
439                 lower_bound(table, table + no_items,
440                             search_tag, &compareTags);
441         // use the compare_ascii_no_case instead of compare_no_case,
442         // because in turkish, 'i' is not the lowercase version of 'I',
443         // and thus turkish locale breaks parsing of tags.
444         if (res != table + no_items
445             && !compare_ascii_no_case(res->tag, tag))
446                 return res->code;
447         return LEX_UNDEF;
448 }
449
450
451 int Lexer::Pimpl::lex()
452 {
453         //NOTE: possible bug.
454         if (next() && status == LEX_TOKEN)
455                 return searchKeyword(getString().c_str());
456         return status;
457 }
458
459
460 bool Lexer::Pimpl::eatLine()
461 {
462         buff.clear();
463
464         unsigned char c = '\0';
465         char cc = 0;
466         while (is && c != '\n') {
467                 is.get(cc);
468                 c = cc;
469                 //LYXERR(Debug::LYXLEX, "Lexer::EatLine read char: `" << c << '\'');
470                 if (c != '\r' && is)
471                         buff.push_back(c);
472         }
473
474         if (c == '\n') {
475                 ++lineno;
476                 buff.resize(buff.size() - 1);
477                 status = LEX_DATA;
478                 return true;
479         } else if (buff.length() > 0) { // last line
480                 status = LEX_DATA;
481                 return true;
482         } else {
483                 return false;
484         }
485 }
486
487
488 bool Lexer::Pimpl::nextToken()
489 {
490         if (!pushTok.empty()) {
491                 // There can have been a whole line pushed so
492                 // we extract the first word and leaves the rest
493                 // in pushTok. (Lgb)
494                 if (pushTok[0] == '\\' && pushTok.find(' ') != string::npos) {
495                         buff.clear();
496                         pushTok = split(pushTok, buff, ' ');
497                 } else {
498                         buff = pushTok;
499                         pushTok.clear();
500                 }
501                 status = LEX_TOKEN;
502                 return true;
503         }
504
505         status = 0;
506         while (is && !status) {
507                 unsigned char c = 0;
508                 char cc = 0;
509                 is.get(cc);
510                 c = cc;
511                 if ((c >= ' ' || c == '\t') && is) {
512                         buff.clear();
513
514                         if (c == '\\') { // first char == '\\'
515                                 do {
516                                         buff.push_back(c);
517                                         is.get(cc);
518                                         c = cc;
519                                 } while (c > ' ' && c != '\\' && is);
520                         } else {
521                                 do {
522                                         buff.push_back(c);
523                                         is.get(cc);
524                                         c = cc;
525                                 } while ((c >= ' ' || c == '\t') && c != '\\' && is);
526                         }
527
528                         if (c == '\\')
529                                 is.putback(c); // put it back
530                         status = LEX_TOKEN;
531                 }
532
533                 if (c == '\n')
534                         ++lineno;
535
536         }
537         if (status)
538                 return true;
539
540         status = is.eof() ? LEX_FEOF: LEX_UNDEF;
541         buff.clear();
542         return false;
543 }
544
545
546 bool Lexer::Pimpl::inputAvailable()
547 {
548         return is.good();
549 }
550
551
552 void Lexer::Pimpl::pushToken(string const & pt)
553 {
554         pushTok = pt;
555 }
556
557
558
559
560 //////////////////////////////////////////////////////////////////////
561 //
562 // Lexer
563 //
564 //////////////////////////////////////////////////////////////////////
565
566 Lexer::Lexer()
567         : pimpl_(new Pimpl(nullptr, 0)), lastReadOk_(false)
568 {}
569
570
571 void Lexer::init(LexerKeyword * tab, int num)
572 {
573          pimpl_ = new Pimpl(tab, num);
574 }
575
576
577 Lexer::~Lexer()
578 {
579         delete pimpl_;
580 }
581
582
583 bool Lexer::isOK() const
584 {
585         return pimpl_->inputAvailable();
586 }
587
588
589 void Lexer::setLineNumber(int l)
590 {
591         pimpl_->lineno = l;
592 }
593
594
595 int Lexer::lineNumber() const
596 {
597         return pimpl_->lineno;
598 }
599
600
601 istream & Lexer::getStream()
602 {
603         return pimpl_->is;
604 }
605
606
607 void Lexer::pushTable(LexerKeyword * tab, int num)
608 {
609         pimpl_->pushTable(tab, num);
610 }
611
612
613 void Lexer::popTable()
614 {
615         pimpl_->popTable();
616 }
617
618
619 void Lexer::printTable(ostream & os)
620 {
621         pimpl_->printTable(os);
622 }
623
624
625 void Lexer::printError(string const & message) const
626 {
627         pimpl_->printError(message);
628 }
629
630
631 bool Lexer::setFile(FileName const & filename)
632 {
633         return pimpl_->setFile(filename);
634 }
635
636
637 void Lexer::setStream(istream & i)
638 {
639         pimpl_->setStream(i);
640 }
641
642
643 void Lexer::setCommentChar(char c)
644 {
645         pimpl_->setCommentChar(c);
646 }
647
648
649 int Lexer::lex()
650 {
651         return pimpl_->lex();
652 }
653
654
655 int Lexer::getInteger() const
656 {
657         lastReadOk_ = pimpl_->status == LEX_DATA || pimpl_->status == LEX_TOKEN;
658         if (!lastReadOk_) {
659                 pimpl_->printError("integer token missing");
660                 return -1;
661         }
662
663         if (isStrInt(pimpl_->getString()))
664                 return convert<int>(pimpl_->getString());
665
666         lastReadOk_ = false;
667         pimpl_->printError("Bad integer `$$Token'");
668         return -1;
669 }
670
671
672 double Lexer::getFloat() const
673 {
674         // replace comma with dot in case the file was written with
675         // the wrong locale (should be rare, but is easy enough to
676         // avoid).
677         lastReadOk_ = pimpl_->status == LEX_DATA || pimpl_->status == LEX_TOKEN;
678         if (!lastReadOk_) {
679                 pimpl_->printError("float token missing");
680                 return -1;
681         }
682
683         string const str = subst(pimpl_->getString(), ",", ".");
684         if (isStrDbl(str))
685                 return convert<double>(str);
686
687         lastReadOk_ = false;
688         pimpl_->printError("Bad float `$$Token'");
689         return -1;
690 }
691
692
693 string const Lexer::getString(bool trim) const
694 {
695         lastReadOk_ = pimpl_->status == LEX_DATA || pimpl_->status == LEX_TOKEN;
696
697         if (lastReadOk_)
698                 return trim ? support::trim(pimpl_->getString(), "\t ") : pimpl_->getString();
699
700         return string();
701 }
702
703
704 docstring const Lexer::getDocString(bool trim) const
705 {
706         lastReadOk_ = pimpl_->status == LEX_DATA || pimpl_->status == LEX_TOKEN;
707
708         if (lastReadOk_)
709                 return trim ? support::trim(pimpl_->getDocString(), "\t ") : pimpl_->getDocString();
710
711         return docstring();
712 }
713
714
715 // I would prefer to give a tag number instead of an explicit token
716 // here, but it is not possible because Buffer::readDocument uses
717 // explicit tokens (JMarc)
718 docstring Lexer::getLongString(docstring const & endtoken)
719 {
720         docstring str;
721         docstring prefix;
722         bool firstline = true;
723
724         while (pimpl_->is) { //< eatLine only reads from is, not from pushTok
725                 if (!eatLine())
726                         // blank line in the file being read
727                         continue;
728                 docstring tmpstr = getDocString();
729                 docstring const token = trim(tmpstr, " \t");
730
731                 LYXERR(Debug::PARSER, "LongString: `" << tmpstr << '\'');
732
733                 // We do a case independent comparison, like searchKeyword does.
734                 if (compare_no_case(token, endtoken) == 0)
735                         break;
736
737                 if (firstline) {
738                         size_t i = tmpstr.find_first_not_of(from_ascii(" \t"));
739                         if (i != string::npos)
740                                 prefix = tmpstr.substr(0, i);
741                         firstline = false;
742                         LYXERR(Debug::PARSER, "Prefix = `" << prefix << "\'");
743                 }
744
745                 // further lines in long strings may have the same
746                 // whitespace prefix as the first line. Remove it.
747                 if (!prefix.empty() && prefixIs(tmpstr, prefix))
748                         tmpstr.erase(0, prefix.length());
749
750                 str += tmpstr + '\n';
751         }
752
753         if (!pimpl_->is)
754                 printError("Long string not ended by `" + to_utf8(endtoken) + '\'');
755
756         return str;
757 }
758
759
760 bool Lexer::getBool() const
761 {
762         string const s = pimpl_->getString();
763         if (s == "false" || s == "0") {
764                 lastReadOk_ = true;
765                 return false;
766         }
767         if (s == "true" || s == "1") {
768                 lastReadOk_ = true;
769                 return true;
770         }
771         pimpl_->printError("Bad boolean `$$Token'. "
772                                  "Use \"false\" or \"true\"");
773         lastReadOk_ = false;
774         return false;
775 }
776
777
778 bool Lexer::eatLine()
779 {
780         return pimpl_->eatLine();
781 }
782
783
784 bool Lexer::next(bool esc)
785 {
786         return pimpl_->next(esc);
787 }
788
789
790 bool Lexer::nextToken()
791 {
792         return pimpl_->nextToken();
793 }
794
795
796 void Lexer::pushToken(string const & pt)
797 {
798         pimpl_->pushToken(pt);
799 }
800
801
802 Lexer::operator void const *() const
803 {
804         // This behaviour is NOT the same as the streams which would
805         // use fail() here. However, our implementation of getString() et al.
806         // can cause the eof() and fail() bits to be set, even though we
807         // haven't tried to read 'em.
808         return lastReadOk_? this : nullptr;
809 }
810
811
812 bool Lexer::operator!() const
813 {
814         return !lastReadOk_;
815 }
816
817
818 Lexer & Lexer::operator>>(string & s)
819 {
820         if (isOK()) {
821                 next();
822                 s = getString();
823         } else {
824                 lastReadOk_ = false;
825         }
826         return *this;
827 }
828
829
830 Lexer & Lexer::operator>>(docstring & s)
831 {
832         if (isOK()) {
833                 next();
834                 s = getDocString();
835         } else {
836                 lastReadOk_ = false;
837         }
838         return *this;
839 }
840
841
842 Lexer & Lexer::operator>>(double & s)
843 {
844         if (isOK()) {
845                 next();
846                 s = getFloat();
847         } else {
848                 lastReadOk_ = false;
849         }
850         return *this;
851 }
852
853
854 Lexer & Lexer::operator>>(int & s)
855 {
856         if (isOK()) {
857                 next();
858                 s = getInteger();
859         } else {
860                 lastReadOk_ = false;
861         }
862         return *this;
863 }
864
865
866 Lexer & Lexer::operator>>(unsigned int & s)
867 {
868         if (isOK()) {
869                 next();
870                 s = getInteger();
871         } else {
872                 lastReadOk_ = false;
873         }
874         return *this;
875 }
876
877
878 Lexer & Lexer::operator>>(bool & s)
879 {
880         if (isOK()) {
881                 next();
882                 s = getBool();
883         } else {
884                 lastReadOk_ = false;
885         }
886         return *this;
887 }
888
889
890 Lexer & Lexer::operator>>(char & c)
891 {
892         string s;
893         operator>>(s);
894         if (!s.empty())
895                 c = s[0];
896         return *this;
897 }
898
899
900 // quotes a string, e.g. for use in preferences files or as an argument
901 // of the "log" dialog
902 string Lexer::quoteString(string const & arg)
903 {
904         string res;
905         res += '"';
906         res += subst(subst(arg, "\\", "\\\\"), "\"", "\\\"");
907         res += '"';
908         return res;
909 }
910
911
912 // same for docstring
913 docstring Lexer::quoteString(docstring const & arg)
914 {
915         docstring res;
916         res += '"';
917         res += subst(subst(arg, from_ascii("\\"), from_ascii("\\\\")),
918                      from_ascii("\""), from_ascii("\\\""));
919         res += '"';
920         return res;
921 }
922
923
924 Lexer & Lexer::operator>>(char const * required)
925 {
926         string token;
927         *this >> token;
928         if (token != required) {
929                 LYXERR0("Missing '" << required << "'-tag in " << pimpl_->context
930                         << ". Got " << token << " instead. Line: " << lineNumber());
931                 pushToken(token);
932         }
933         return *this;
934 }
935
936
937 bool Lexer::checkFor(char const * required)
938 {
939         string token;
940         *this >> token;
941         if (token == required)
942                 return true;
943         pushToken(token);
944         return false;
945 }
946
947
948 void Lexer::setContext(std::string const & functionName)
949 {
950         pimpl_->context = functionName;
951 }
952
953
954 } // namespace lyx