3 * This file is part of the KDE project, module kdesu.
4 * Copyright (C) 1999,2000 Geert Jansen <jansen@kde.org>
6 * lexer.cpp: A lexer for the kdesud protocol. See kdesud.cpp for a
7 * description of the protocol.
15 Lexer::Lexer(const QByteArray
&input
)
28 QByteArray
&Lexer::lval()
34 * lex() is the lexer. There is no end-of-input check here so that has to be
52 // No control characters
57 while (isspace(c
= m_Input
[in
++]))
64 while (isdigit(c
= m_Input
[in
++]))
74 while ((c
!= '"') && !iscntrl(c
)) {
75 // handle escaped characters
77 m_Output
+= m_Input
[in
++];
88 while (!isspace(c
) && !iscntrl(c
))
96 if (m_Output
.length() <= 4)
98 if (m_Output
== "EXEC")
100 if (m_Output
== "PASS")
102 if (m_Output
== "DEL")
104 if (m_Output
== "PING")
106 if (m_Output
== "EXIT")
108 if (m_Output
== "STOP")
110 if (m_Output
== "SET")
112 if (m_Output
== "GET")
114 if (m_Output
== "HOST")
116 if (m_Output
== "SCHD")
118 if (m_Output
== "PRIO")
120 if (m_Output
== "DELV")
122 if (m_Output
== "DELG")
124 if (m_Output
== "DELS")
125 return Tok_delSpecialKey
;
126 if (m_Output
== "GETK")
128 if (m_Output
== "CHKG")