MuseScore  3.4
Music composition and notation
lexer.h
Go to the documentation of this file.
1 //=============================================================================
2 // BWW to MusicXML converter
3 // Part of MusE Score
4 // Linux Music Score Editor
5 //
6 // Copyright (C) 2010 Werner Schweer and others
7 //
8 // This program is free software; you can redistribute it and/or modify
9 // it under the terms of the GNU General Public License version 2.
10 //
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
15 //
16 // You should have received a copy of the GNU General Public License
17 // along with this program; if not, write to the Free Software
18 // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 //=============================================================================
20 
21 #ifndef LEXER_H
22 #define LEXER_H
23 
29 #include <QtCore/QMap>
30 #include <QtCore/QString>
31 #include <QtCore/QStringList>
32 #include <QtCore/QTextStream>
33 
34 #include "symbols.h"
35 
36 class QIODevice;
37 
38 namespace Bww {
39 
44  class Lexer
45  {
46  public:
47  Lexer(QIODevice *inDevice);
48  void getSym();
49  Symbol symType() const;
50  QString symValue() const;
51  int symLineNumber() const { return lineNumber; }
52  private:
53  void categorizeWord(QString word);
54  QTextStream in;
55  QString line;
56  int lineNumber;
57  QStringList list;
59  QString value;
60  QMap<QString, QString> graceMap;
61  };
62 
63 } // namespace Bww
64 
65 #endif // LEXER_H
int lineNumber
The current line number (zero-based)
Definition: lexer.h:56
QString value
Last symbol value.
Definition: lexer.h:59
QString symValue() const
Return the current symbols value.
Definition: lexer.cpp:438
Symbol type
Last symbol type.
Definition: lexer.h:58
Symbol type to text translation.
Definition: lexer.cpp:34
Symbol symType() const
Return the current symbols type.
Definition: lexer.cpp:429
QMap< QString, QString > graceMap
Map bww embellishments to separate grace notes.
Definition: lexer.h:60
QString line
The current line.
Definition: lexer.h:55
void categorizeWord(QString word)
Determine the symbol type for word.
Definition: lexer.cpp:447
int symLineNumber() const
Definition: lexer.h:51
QStringList list
Unprocessed words.
Definition: lexer.h:57
Definition of tokens types for bww lexer and parser.
The bww lexer.
Definition: lexer.h:44
Lexer(QIODevice *inDevice)
Lexer constructor, inDevice is the input.
Definition: lexer.cpp:40
QTextStream in
Input stream.
Definition: lexer.h:54
Symbol
Definition: symbols.h:31
void getSym()
Get the next symbol, update type and value.
Definition: lexer.cpp:343