AMU Library 3.0
C/C++ library for communicating with AMU (Aerospace Measurement Unit) devices
Loading...
Searching...
No Matches
lexer.c
Go to the documentation of this file.
1/*-
2 * Copyright (c) 2012-2013 Jan Breuer,
3 *
4 * All Rights Reserved
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are
8 * met:
9 * 1. Redistributions of source code must retain the above copyright notice,
10 * this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 *
15 * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
16 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18 * DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
22 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
23 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
24 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
25 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
36
37#include <ctype.h>
38#include <stdio.h>
39#include <string.h>
40
41#include "lexer_private.h"
42#include "error.h"
43
49static int isws(int c) {
50 if ((c == ' ') || (c == '\t')) {
51 return 1;
52 }
53 return 0;
54}
55
61static int isbdigit(int c) {
62 if ((c == '0') || (c == '1')) {
63 return 1;
64 }
65 return 0;
66}
67
73static int isqdigit(int c) {
74 if ((c == '0') || (c == '1') || (c == '2') || (c == '3') || (c == '4') || (c == '5') || (c == '6') || (c == '7')) {
75 return 1;
76 }
77 return 0;
78}
79
85static int iseos(lex_state_t * state) {
86 if ((state->buffer + state->len) <= (state->pos)) {
87 return 1;
88 } else {
89 return 0;
90 }
91}
92
98int scpiLex_IsEos(lex_state_t * state) {
99 return iseos(state);
100}
101
108static int ischr(lex_state_t * state, char chr) {
109 return (state->pos[0] == chr);
110}
111
117static int isplusmn(int c) {
118 return c == '+' || c == '-';
119}
120
126static int isH(int c) {
127 return c == 'h' || c == 'H';
128}
129
135static int isB(int c) {
136 return c == 'b' || c == 'B';
137}
138
144static int isQ(int c) {
145 return c == 'q' || c == 'Q';
146}
147
153static int isE(int c) {
154 return c == 'e' || c == 'E';
155}
156
157#define SKIP_NONE 0
158#define SKIP_OK 1
159#define SKIP_INCOMPLETE -1
160
161/* skip characters */
162/* 7.4.1 <PROGRAM MESSAGE UNIT SEPARATOR>*/
163/* TODO: static int skipProgramMessageUnitSeparator(lex_state_t * state) */
164
170static int skipWs(lex_state_t * state) {
171 int someSpace = 0;
172 while (!iseos(state) && isws(state->pos[0])) {
173 state->pos++;
174 someSpace++;
175 }
176
177 return someSpace;
178}
179
180/* 7.4.2 <PROGRAM DATA SEPARATOR> */
181/* static int skipProgramDataSeparator(lex_state_t * state) */
182
183/* 7.5.2 <PROGRAM MESSAGE TERMINATOR> */
184/* static int skipProgramMessageTerminator(lex_state_t * state) */
185
191static int skipDigit(lex_state_t * state) {
192 if (!iseos(state) && isdigit((uint8_t)(state->pos[0]))) {
193 state->pos++;
194 return SKIP_OK;
195 } else {
196 return SKIP_NONE;
197 }
198}
199
205static int skipNumbers(lex_state_t * state) {
206 int someNumbers = 0;
207 while (!iseos(state) && isdigit((uint8_t)(state->pos[0]))) {
208 state->pos++;
209 someNumbers++;
210 }
211 return someNumbers;
212}
213
219static int skipPlusmn(lex_state_t * state) {
220 if (!iseos(state) && isplusmn(state->pos[0])) {
221 state->pos++;
222 return SKIP_OK;
223 } else {
224 return SKIP_NONE;
225 }
226}
227
233static int skipAlpha(lex_state_t * state) {
234 int someLetters = 0;
235 while (!iseos(state) && isalpha((uint8_t)(state->pos[0]))) {
236 state->pos++;
237 someLetters++;
238 }
239 return someLetters;
240}
241
248static int skipChr(lex_state_t * state, char chr) {
249 if (!iseos(state) && ischr(state, chr)) {
250 state->pos++;
251 return SKIP_OK;
252 } else {
253 return SKIP_NONE;
254 }
255}
256
262static int skipSlashDot(lex_state_t * state) {
263 if (!iseos(state) && (ischr(state, '/') | ischr(state, '.'))) {
264 state->pos++;
265 return SKIP_OK;
266 } else {
267 return SKIP_NONE;
268 }
269}
270
276static int skipStar(lex_state_t * state) {
277 if (!iseos(state) && ischr(state, '*')) {
278 state->pos++;
279 return SKIP_OK;
280 } else {
281 return SKIP_NONE;
282 }
283}
284
290static int skipColon(lex_state_t * state) {
291 if (!iseos(state) && ischr(state, ':')) {
292 state->pos++;
293 return SKIP_OK;
294 } else {
295 return SKIP_NONE;
296 }
297}
298
299/* 7.6.1.2 <COMMAND PROGRAM HEADER> */
300
306static int skipProgramMnemonic(lex_state_t * state) {
307 const char * startPos = state->pos;
308 if (!iseos(state) && isalpha((uint8_t)(state->pos[0]))) {
309 state->pos++;
310 while (!iseos(state) && (isalnum((uint8_t)(state->pos[0])) || ischr(state, '_'))) {
311 state->pos++;
312 }
313 }
314
315 if (iseos(state)) {
316 return (state->pos - startPos) * SKIP_INCOMPLETE;
317 } else {
318 return (state->pos - startPos) * SKIP_OK;
319 }
320}
321
322/* tokens */
323
330int scpiLex_WhiteSpace(lex_state_t * state, scpi_token_t * token) {
331 token->ptr = state->pos;
332
333 skipWs(state);
334
335 token->len = state->pos - token->ptr;
336
337 if (token->len > 0) {
338 token->type = SCPI_TOKEN_WS;
339 } else {
340 token->type = SCPI_TOKEN_UNKNOWN;
341 }
342
343 return token->len;
344}
345
346/* 7.6.1 <COMMAND PROGRAM HEADER> */
347
353static int skipCommonProgramHeader(lex_state_t * state) {
354 int res;
355 if (skipStar(state)) {
356 res = skipProgramMnemonic(state);
357 if (res == SKIP_NONE && iseos(state)) {
358 return SKIP_INCOMPLETE;
359 } else if (res <= SKIP_INCOMPLETE) {
360 return SKIP_OK;
361 } else if (res >= SKIP_OK) {
362 return SKIP_OK;
363 } else {
364 return SKIP_INCOMPLETE;
365 }
366 }
367 return SKIP_NONE;
368}
369
375static int skipCompoundProgramHeader(lex_state_t * state) {
376 int res;
377 int firstColon = skipColon(state);
378
379 res = skipProgramMnemonic(state);
380 if (res >= SKIP_OK) {
381 while (skipColon(state)) {
382 res = skipProgramMnemonic(state);
383 if (res <= SKIP_INCOMPLETE) {
384 return SKIP_OK;
385 } else if (res == SKIP_NONE) {
386 return SKIP_INCOMPLETE;
387 }
388 }
389 return SKIP_OK;
390 } else if (res <= SKIP_INCOMPLETE) {
391 return SKIP_OK;
392 } else if (firstColon) {
393 return SKIP_INCOMPLETE;
394 } else {
395 return SKIP_NONE;
396 }
397}
398
405int scpiLex_ProgramHeader(lex_state_t * state, scpi_token_t * token) {
406 int res;
407 token->ptr = state->pos;
408 token->type = SCPI_TOKEN_UNKNOWN;
409
410 res = skipCommonProgramHeader(state);
411 if (res >= SKIP_OK) {
412 if (skipChr(state, '?') >= SKIP_OK) {
414 } else {
416 }
417 } else if (res <= SKIP_INCOMPLETE) {
419 } else if (res == SKIP_NONE) {
420 res = skipCompoundProgramHeader(state);
421
422 if (res >= SKIP_OK) {
423 if (skipChr(state, '?') >= SKIP_OK) {
425 } else {
427 }
428 } else if (res <= SKIP_INCOMPLETE) {
430 }
431 }
432
433 if (token->type != SCPI_TOKEN_UNKNOWN) {
434 token->len = state->pos - token->ptr;
435 } else {
436 token->len = 0;
437 state->pos = token->ptr;
438 }
439
440 return token->len;
441}
442
443/* 7.7.1 <CHARACTER PROGRAM DATA> */
444
451int scpiLex_CharacterProgramData(lex_state_t * state, scpi_token_t * token) {
452 token->ptr = state->pos;
453
454 if (!iseos(state) && isalpha((uint8_t)(state->pos[0]))) {
455 state->pos++;
456 while (!iseos(state) && (isalnum((uint8_t)(state->pos[0])) || ischr(state, '_'))) {
457 state->pos++;
458 }
459 }
460
461 token->len = state->pos - token->ptr;
462 if (token->len > 0) {
463 token->type = SCPI_TOKEN_PROGRAM_MNEMONIC;
464 } else {
465 token->type = SCPI_TOKEN_UNKNOWN;
466 }
467
468 return token->len;
469}
470
471/* 7.7.2 <DECIMAL NUMERIC PROGRAM DATA> */
472static int skipMantisa(lex_state_t * state) {
473 int someNumbers = 0;
474
475 skipPlusmn(state);
476
477 someNumbers += skipNumbers(state);
478
479 if (skipChr(state, '.')) {
480 someNumbers += skipNumbers(state);
481 }
482
483 return someNumbers;
484}
485
486static int skipExponent(lex_state_t * state) {
487 int someNumbers = 0;
488
489 if (!iseos(state) && isE(state->pos[0])) {
490 state->pos++;
491
492 skipWs(state);
493
494 skipPlusmn(state);
495
496 someNumbers = skipNumbers(state);
497 }
498
499 return someNumbers;
500}
501
508int scpiLex_DecimalNumericProgramData(lex_state_t * state, scpi_token_t * token) {
509 char * rollback;
510 token->ptr = state->pos;
511
512 if (skipMantisa(state)) {
513 rollback = state->pos;
514 skipWs(state);
515 if (!skipExponent(state)) {
516 state->pos = rollback;
517 }
518 } else {
519 state->pos = token->ptr;
520 }
521
522 token->len = state->pos - token->ptr;
523 if (token->len > 0) {
525 } else {
526 token->type = SCPI_TOKEN_UNKNOWN;
527 }
528
529 return token->len;
530}
531
532/* 7.7.3 <SUFFIX PROGRAM DATA> */
533int scpiLex_SuffixProgramData(lex_state_t * state, scpi_token_t * token) {
534 token->ptr = state->pos;
535
536 skipChr(state, '/');
537
538 /* TODO: strict parsing : SLASH? (ALPHA+ (MINUS? DIGIT)?) ((SLASH | DOT) (ALPHA+ (MINUS? DIGIT)?))* */
539 if (skipAlpha(state)) {
540 skipChr(state, '-');
541 skipDigit(state);
542
543 while (skipSlashDot(state)) {
544 skipAlpha(state);
545 skipChr(state, '-');
546 skipDigit(state);
547 }
548 }
549
550 token->len = state->pos - token->ptr;
551 if ((token->len > 0)) {
552 token->type = SCPI_TOKEN_SUFFIX_PROGRAM_DATA;
553 } else {
554 token->type = SCPI_TOKEN_UNKNOWN;
555 state->pos = token->ptr;
556 token->len = 0;
557 }
558
559 return token->len;
560}
561
562/* 7.7.4 <NONDECIMAL NUMERIC PROGRAM DATA> */
563static int skipHexNum(lex_state_t * state) {
564 int someNumbers = 0;
565 while (!iseos(state) && isxdigit((uint8_t)(state->pos[0]))) {
566 state->pos++;
567 someNumbers++;
568 }
569 return someNumbers;
570}
571
572static int skipOctNum(lex_state_t * state) {
573 int someNumbers = 0;
574 while (!iseos(state) && isqdigit(state->pos[0])) {
575 state->pos++;
576 someNumbers++;
577 }
578 return someNumbers;
579}
580
581static int skipBinNum(lex_state_t * state) {
582 int someNumbers = 0;
583 while (!iseos(state) && isbdigit(state->pos[0])) {
584 state->pos++;
585 someNumbers++;
586 }
587 return someNumbers;
588}
589
596int scpiLex_NondecimalNumericData(lex_state_t * state, scpi_token_t * token) {
597 int someNumbers = 0;
598 token->ptr = state->pos;
599 if (skipChr(state, '#')) {
600 if (!iseos(state)) {
601 if (isH(state->pos[0])) {
602 state->pos++;
603 someNumbers = skipHexNum(state);
604 token->type = SCPI_TOKEN_HEXNUM;
605 } else if (isQ(state->pos[0])) {
606 state->pos++;
607 someNumbers = skipOctNum(state);
608 token->type = SCPI_TOKEN_OCTNUM;
609 } else if (isB(state->pos[0])) {
610 state->pos++;
611 someNumbers = skipBinNum(state);
612 token->type = SCPI_TOKEN_BINNUM;
613 }
614 }
615 }
616
617 if (someNumbers) {
618 token->ptr += 2; /* ignore number prefix */
619 token->len = state->pos - token->ptr;
620 } else {
621 token->type = SCPI_TOKEN_UNKNOWN;
622 state->pos = token->ptr;
623 token->len = 0;
624 }
625 return token->len > 0 ? token->len + 2 : 0;
626}
627
628/* 7.7.5 <STRING PROGRAM DATA> */
629static int isascii7bit(int c) {
630 return (c >= 0) && (c <= 0x7f);
631}
632
633static void skipQuoteProgramData(lex_state_t * state, char quote) {
634 while (!iseos(state)) {
635 if (isascii7bit(state->pos[0]) && !ischr(state, quote)) {
636 state->pos++;
637 } else if (ischr(state, quote)) {
638 state->pos++;
639 if (!iseos(state) && ischr(state, quote)) {
640 state->pos++;
641 } else {
642 state->pos--;
643 break;
644 }
645 } else {
646 break;
647 }
648 }
649}
650
651static void skipDoubleQuoteProgramData(lex_state_t * state) {
652 skipQuoteProgramData(state, '"');
653}
654
655static void skipSingleQuoteProgramData(lex_state_t * state) {
656 skipQuoteProgramData(state, '\'');
657}
658
665int scpiLex_StringProgramData(lex_state_t * state, scpi_token_t * token) {
666 token->ptr = state->pos;
667
668 if (!iseos(state)) {
669 if (ischr(state, '"')) {
670 state->pos++;
673 if (!iseos(state) && ischr(state, '"')) {
674 state->pos++;
675 token->len = state->pos - token->ptr;
676 } else {
677 state->pos = token->ptr;
678 }
679 } else if (ischr(state, '\'')) {
680 state->pos++;
683 if (!iseos(state) && ischr(state, '\'')) {
684 state->pos++;
685 token->len = state->pos - token->ptr;
686 } else {
687 state->pos = token->ptr;
688 }
689 }
690 }
691
692 token->len = state->pos - token->ptr;
693
694 if ((token->len > 0)) {
695 /* token->ptr++;
696 * token->len -= 2; */
697 } else {
698 token->type = SCPI_TOKEN_UNKNOWN;
699 state->pos = token->ptr;
700 token->len = 0;
701 }
702
703 return token->len > 0 ? token->len : 0;
704}
705
706/* 7.7.6 <ARBITRARY BLOCK PROGRAM DATA> */
707static int isNonzeroDigit(int c) {
708 return isdigit(c) && (c != '0');
709}
710
717int scpiLex_ArbitraryBlockProgramData(lex_state_t * state, scpi_token_t * token) {
718 int i;
719 int arbitraryBlockLength = 0;
720 const char * ptr = state->pos;
721 int validData = -1;
722 token->ptr = state->pos;
723
724 if (skipChr(state, '#')) {
725 if (!iseos(state) && isNonzeroDigit(state->pos[0])) {
726 /* Get number of digits */
727 i = state->pos[0] - '0';
728 state->pos++;
729
730 for (; i > 0; i--) {
731 if (!iseos(state) && isdigit((uint8_t)(state->pos[0]))) {
732 arbitraryBlockLength *= 10;
733 arbitraryBlockLength += (state->pos[0] - '0');
734 state->pos++;
735 } else {
736 break;
737 }
738 }
739
740 if (i == 0) {
741 state->pos += arbitraryBlockLength;
742 if ((state->buffer + state->len) >= (state->pos)) {
743 token->ptr = state->pos - arbitraryBlockLength;
744 token->len = arbitraryBlockLength;
745 validData = 1;
746 } else {
747 validData = 0;
748 }
749 } else if (iseos(state)) {
750 validData = 0;
751 }
752 } else if (iseos(state)) {
753 validData = 0;
754 }
755 }
756
757 if (validData == 1) {
758 /* valid */
760 } else if (validData == 0) {
761 /* incomplete */
762 token->type = SCPI_TOKEN_UNKNOWN;
763 token->len = 0;
764 state->pos = state->buffer + state->len;
765 } else {
766 /* invalid */
767 token->type = SCPI_TOKEN_UNKNOWN;
768 state->pos = token->ptr;
769 token->len = 0;
770 }
771
772 return token->len + (token->ptr - ptr);
773}
774
775/* 7.7.7 <EXPRESSION PROGRAM DATA> */
776static int isProgramExpression(int c) {
777 if ((c >= 0x20) && (c <= 0x7e)) {
778 if ((c != '"')
779 && (c != '#')
780 && (c != '\'')
781 && (c != '(')
782 && (c != ')')
783 && (c != ';')) {
784 return 1;
785 }
786 }
787
788 return 0;
789}
790
791static void skipProgramExpression(lex_state_t * state) {
792 while (!iseos(state) && isProgramExpression(state->pos[0])) {
793 state->pos++;
794 }
795}
796
797/* TODO: 7.7.7.2-2 recursive - any program data */
798
805int scpiLex_ProgramExpression(lex_state_t * state, scpi_token_t * token) {
806 token->ptr = state->pos;
807
808 if (!iseos(state) && ischr(state, '(')) {
809 state->pos++;
811
812 if (!iseos(state) && ischr(state, ')')) {
813 state->pos++;
814 token->len = state->pos - token->ptr;
815 } else {
816 token->len = 0;
817 }
818 }
819
820 if ((token->len > 0)) {
821 token->type = SCPI_TOKEN_PROGRAM_EXPRESSION;
822 } else {
823 token->type = SCPI_TOKEN_UNKNOWN;
824 state->pos = token->ptr;
825 token->len = 0;
826 }
827
828 return token->len;
829}
830
837int scpiLex_Comma(lex_state_t * state, scpi_token_t * token) {
838 token->ptr = state->pos;
839
840 if (skipChr(state, ',')) {
841 token->len = 1;
842 token->type = SCPI_TOKEN_COMMA;
843 } else {
844 token->len = 0;
845 token->type = SCPI_TOKEN_UNKNOWN;
846 }
847
848 return token->len;
849}
850
857int scpiLex_Semicolon(lex_state_t * state, scpi_token_t * token) {
858 token->ptr = state->pos;
859
860 if (skipChr(state, ';')) {
861 token->len = 1;
862 token->type = SCPI_TOKEN_SEMICOLON;
863 } else {
864 token->len = 0;
865 token->type = SCPI_TOKEN_UNKNOWN;
866 }
867
868 return token->len;
869}
870
877int scpiLex_Colon(lex_state_t * state, scpi_token_t * token) {
878 token->ptr = state->pos;
879
880 if (skipChr(state, ':')) {
881 token->len = 1;
882 token->type = SCPI_TOKEN_COLON;
883 } else {
884 token->len = 0;
885 token->type = SCPI_TOKEN_UNKNOWN;
886 }
887
888 return token->len;
889}
890
897int scpiLex_SpecificCharacter(lex_state_t * state, scpi_token_t * token, char chr) {
898 token->ptr = state->pos;
899
900 if (skipChr(state, chr)) {
901 token->len = 1;
902 token->type = SCPI_TOKEN_SPECIFIC_CHARACTER;
903 } else {
904 token->len = 0;
905 token->type = SCPI_TOKEN_UNKNOWN;
906 }
907
908 return token->len;
909}
910
917int scpiLex_NewLine(lex_state_t * state, scpi_token_t * token) {
918 token->ptr = state->pos;
919
920 skipChr(state, '\r');
921 skipChr(state, '\n');
922
923 token->len = state->pos - token->ptr;
924
925 if ((token->len > 0)) {
926 token->type = SCPI_TOKEN_NL;
927 } else {
928 token->type = SCPI_TOKEN_UNKNOWN;
929 state->pos = token->ptr;
930 token->len = 0;
931 }
932
933 return token->len;
934}
static int skipProgramMnemonic(lex_state_t *state)
Definition lexer.c:306
static int skipExponent(lex_state_t *state)
Definition lexer.c:486
static int isH(int c)
Definition lexer.c:126
static int isE(int c)
Definition lexer.c:153
static int skipWs(lex_state_t *state)
Definition lexer.c:170
static int skipCompoundProgramHeader(lex_state_t *state)
Definition lexer.c:375
static int skipAlpha(lex_state_t *state)
Definition lexer.c:233
static int ischr(lex_state_t *state, char chr)
Definition lexer.c:108
static int isbdigit(int c)
Definition lexer.c:61
int scpiLex_NewLine(lex_state_t *state, scpi_token_t *token)
Definition lexer.c:917
#define SKIP_NONE
Definition lexer.c:157
static int skipPlusmn(lex_state_t *state)
Definition lexer.c:219
int scpiLex_StringProgramData(lex_state_t *state, scpi_token_t *token)
Definition lexer.c:665
static void skipProgramExpression(lex_state_t *state)
Definition lexer.c:791
int scpiLex_ProgramExpression(lex_state_t *state, scpi_token_t *token)
Definition lexer.c:805
static int isQ(int c)
Definition lexer.c:144
static int skipDigit(lex_state_t *state)
Definition lexer.c:191
static void skipQuoteProgramData(lex_state_t *state, char quote)
Definition lexer.c:633
int scpiLex_ArbitraryBlockProgramData(lex_state_t *state, scpi_token_t *token)
Definition lexer.c:717
static int isProgramExpression(int c)
Definition lexer.c:776
static int skipCommonProgramHeader(lex_state_t *state)
Definition lexer.c:353
static int skipOctNum(lex_state_t *state)
Definition lexer.c:572
static int skipBinNum(lex_state_t *state)
Definition lexer.c:581
static int isascii7bit(int c)
Definition lexer.c:629
int scpiLex_DecimalNumericProgramData(lex_state_t *state, scpi_token_t *token)
Definition lexer.c:508
#define SKIP_INCOMPLETE
Definition lexer.c:159
static int iseos(lex_state_t *state)
Definition lexer.c:85
static int isqdigit(int c)
Definition lexer.c:73
#define SKIP_OK
Definition lexer.c:158
static void skipDoubleQuoteProgramData(lex_state_t *state)
Definition lexer.c:651
int scpiLex_ProgramHeader(lex_state_t *state, scpi_token_t *token)
Definition lexer.c:405
int scpiLex_SpecificCharacter(lex_state_t *state, scpi_token_t *token, char chr)
Definition lexer.c:897
int scpiLex_SuffixProgramData(lex_state_t *state, scpi_token_t *token)
Definition lexer.c:533
static int isplusmn(int c)
Definition lexer.c:117
static void skipSingleQuoteProgramData(lex_state_t *state)
Definition lexer.c:655
static int isB(int c)
Definition lexer.c:135
int scpiLex_Semicolon(lex_state_t *state, scpi_token_t *token)
Definition lexer.c:857
static int isNonzeroDigit(int c)
Definition lexer.c:707
static int isws(int c)
Definition lexer.c:49
static int skipColon(lex_state_t *state)
Definition lexer.c:290
static int skipMantisa(lex_state_t *state)
Definition lexer.c:472
static int skipHexNum(lex_state_t *state)
Definition lexer.c:563
int scpiLex_IsEos(lex_state_t *state)
Definition lexer.c:98
int scpiLex_CharacterProgramData(lex_state_t *state, scpi_token_t *token)
Definition lexer.c:451
int scpiLex_WhiteSpace(lex_state_t *state, scpi_token_t *token)
Definition lexer.c:330
static int skipChr(lex_state_t *state, char chr)
Definition lexer.c:248
static int skipStar(lex_state_t *state)
Definition lexer.c:276
static int skipSlashDot(lex_state_t *state)
Definition lexer.c:262
int scpiLex_Comma(lex_state_t *state, scpi_token_t *token)
Definition lexer.c:837
int scpiLex_Colon(lex_state_t *state, scpi_token_t *token)
Definition lexer.c:877
static int skipNumbers(lex_state_t *state)
Definition lexer.c:205
int scpiLex_NondecimalNumericData(lex_state_t *state, scpi_token_t *token)
Definition lexer.c:596
@ SCPI_TOKEN_PROGRAM_MNEMONIC
Definition types.h:156
@ SCPI_TOKEN_BINNUM
Definition types.h:155
@ SCPI_TOKEN_DOUBLE_QUOTE_PROGRAM_DATA
Definition types.h:162
@ SCPI_TOKEN_SEMICOLON
Definition types.h:148
@ SCPI_TOKEN_COMMON_QUERY_PROGRAM_HEADER
Definition types.h:169
@ SCPI_TOKEN_SINGLE_QUOTE_PROGRAM_DATA
Definition types.h:161
@ SCPI_TOKEN_COMPOUND_QUERY_PROGRAM_HEADER
Definition types.h:168
@ SCPI_TOKEN_INCOMPLETE_COMMON_PROGRAM_HEADER
Definition types.h:167
@ SCPI_TOKEN_DECIMAL_NUMERIC_PROGRAM_DATA
Definition types.h:157
@ SCPI_TOKEN_SPECIFIC_CHARACTER
Definition types.h:150
@ SCPI_TOKEN_COMMA
Definition types.h:147
@ SCPI_TOKEN_OCTNUM
Definition types.h:154
@ SCPI_TOKEN_NL
Definition types.h:152
@ SCPI_TOKEN_HEXNUM
Definition types.h:153
@ SCPI_TOKEN_COLON
Definition types.h:149
@ SCPI_TOKEN_COMMON_PROGRAM_HEADER
Definition types.h:166
@ SCPI_TOKEN_ARBITRARY_BLOCK_PROGRAM_DATA
Definition types.h:160
@ SCPI_TOKEN_WS
Definition types.h:170
@ SCPI_TOKEN_PROGRAM_EXPRESSION
Definition types.h:163
@ SCPI_TOKEN_INCOMPLETE_COMPOUND_PROGRAM_HEADER
Definition types.h:165
@ SCPI_TOKEN_COMPOUND_PROGRAM_HEADER
Definition types.h:164
@ SCPI_TOKEN_SUFFIX_PROGRAM_DATA
Definition types.h:159
@ SCPI_TOKEN_UNKNOWN
Definition types.h:173