Remove minus since it's an invalid literal

This commit is contained in:
thez3ro 2017-12-30 14:16:18 +01:00
parent e803076063
commit 6d046f251e
No known key found for this signature in database
GPG Key ID: F628F9E41DD7C073
3 changed files with 6 additions and 3 deletions

View File

@ -616,7 +616,7 @@ bool AutoType::checkSyntax(const QString& string)
// the ":" allows custom commands with syntax S:Field // the ":" allows custom commands with syntax S:Field
// exclude BEEP otherwise will be checked as valid // exclude BEEP otherwise will be checked as valid
QString normalCommands = "(?!BEEP\\s)[A-Z:]*" + allowRepetition; QString normalCommands = "(?!BEEP\\s)[A-Z:]*" + allowRepetition;
QString specialLiterals = "[\\^\\%\\(\\)~\\{\\}\\[\\]\\+-]" + allowRepetition; QString specialLiterals = "[\\^\\%\\(\\)~\\{\\}\\[\\]\\+]" + allowRepetition;
QString functionKeys = "(?:F[1-9]" + allowRepetition + "|F1[0-2])" + allowRepetition; QString functionKeys = "(?:F[1-9]" + allowRepetition + "|F1[0-2])" + allowRepetition;
QString numpad = "NUMPAD\\d" + allowRepetition; QString numpad = "NUMPAD\\d" + allowRepetition;
QString delay = "DELAY=\\d+"; QString delay = "DELAY=\\d+";

View File

@ -31,7 +31,6 @@
#include <QTemporaryFile> #include <QTemporaryFile>
#include <QMimeData> #include <QMimeData>
#include <QEvent> #include <QEvent>
#include <iostream>
#include "autotype/AutoType.h" #include "autotype/AutoType.h"
#include "core/Config.h" #include "core/Config.h"

View File

@ -286,7 +286,7 @@ void TestAutoType::testGlobalAutoTypeRegExp()
void TestAutoType::testAutoTypeSyntaxChecks() void TestAutoType::testAutoTypeSyntaxChecks()
{ {
// Huge sequence // Huge sequence
QCOMPARE(true, AutoType::checkSyntax("{word 23}{F1 23}{~ 23}{% 23}{^}{F12}{(}{) 23}{[}{[}{]}{Delay=23}{+}{-}~+%@fixedstring")); QCOMPARE(true, AutoType::checkSyntax("{word 23}{F1 23}{~ 23}{% 23}{^}{F12}{(}{) 23}{[}{[}{]}{Delay=23}{+}{SUBTRACT}~+%@fixedstring"));
QCOMPARE(true, AutoType::checkSyntax("{NUMPAD1 3}")); QCOMPARE(true, AutoType::checkSyntax("{NUMPAD1 3}"));
@ -298,6 +298,10 @@ void TestAutoType::testAutoTypeSyntaxChecks()
QCOMPARE(true, AutoType::checkSyntax("{VKEY-EX 0x01}")); QCOMPARE(true, AutoType::checkSyntax("{VKEY-EX 0x01}"));
// Bad sequence // Bad sequence
QCOMPARE(false, AutoType::checkSyntax("{{{}}{}{}}{{}}")); QCOMPARE(false, AutoType::checkSyntax("{{{}}{}{}}{{}}"));
// Good sequence
QCOMPARE(true, AutoType::checkSyntax("{{}{}}{}}{{}"));
QCOMPARE(true, AutoType::checkSyntax("{]}{[}{[}{]}"));
QCOMPARE(true, AutoType::checkSyntax("{)}{(}{(}{)}"));
// High DelAY / low delay // High DelAY / low delay
QCOMPARE(true, AutoType::checkHighDelay("{DelAY 50000}")); QCOMPARE(true, AutoType::checkHighDelay("{DelAY 50000}"));
QCOMPARE(false, AutoType::checkHighDelay("{delay 50}")); QCOMPARE(false, AutoType::checkHighDelay("{delay 50}"));