fpt and WinFPT Reference Manual - Command-line Commands

| SimCon Home | Ref Manual Home |

An example of a Computed GOTO

A simple example of a computed GOTO from the lexical analyser of fpt. This jumps to the handlers for all of the possible characters which begin a token.

! Switch on the character C, first character of an ! identifier or operator or white space ! ! ASCII list ! 0 NUL,SOH,STX,ETX,EOT,ENQ,ACK,BEL, 0-7 0-7 ! 1 BS ,TAB,LF ,VTB,FF ,CR ,SO ,SI , 8-15 8-F ! 2 DLE,DC1,DC2,DC3,DC4,NAK,SYN,ETB, 16-23 10-17 ! 3 CAN,EM ,SUB,ESC,FS ,GS ,RS ,US , 24-31 18-1F ! 4 SPA,! " # $ % & ' 32-39 20-27 ! 5 ( ) * + , - . / 40-47 28-2F ! 6 0 1 2 3 4 5 6 7 48-55 30-37 ! 7 8 9 : ; < = > ? 56-63 38-3F ! 8 @ A B C D E F G 64-71 40-47 ! 9 H I J K L M N O 72-79 48-4F ! 1 P Q R S T U V W 80-87 50-57 ! 2 X Y Z [ \ ] ^ _ 88-95 58-5F ! 3 ` a b c d e f g 96-103 60-67 ! 4 h i j k l m n o 104-111 68-6F ! 5 p q r s t u v w 112-119 70-77 ! 6 x y z { | } ~ DEL 120-127 78-7F ! GOTO (2850,2550,2550,4850,4900,2550,2550, & ! 0 2550,2500,1500,1500,1500,1500,2550,2550, & ! 1 2550,2550,2550,2550,2550,2550,2550,2550, & ! 2 2550,2550,2550,2550,2550,2550,2550,2550, & ! 3 1500,2900,4250,4500,4550,4600,4700,3700, & ! 4 2950,3000,3050,3100,3150,3200,3250,3300, & ! 5 2800,2800,2800,2800,2800,2800,2800,2800, & ! 6 2800,2800,3350,4450,3400,3450,3500,4400, & ! 7 4750,2750,2750,2750,2750,2750,2750,2750, & ! 8 2750,2750,2750,2750,2750,2750,2750,2750, & ! 9 2750,2750,2750,2750,2750,2750,2750,2750, & ! 1 2750,2750,2750,3550,4650,3600,3700,4800, & ! 2 2600,2700,2700,2700,2700,2700,2700,2700, & ! 3 2700,2700,2700,2700,2700,2700,2700,2700, & ! 4 2700,2700,2700,2700,2700,2700,2700,2700, & ! 5 2700,2700,2700,2600,2600,2600,2600,2600)ICHAR(c) ! Note that CHAR(1) is a truncation marker ! ! Fall through switch. non-ASCII character CALL fpterr(0907,2,perpre,perrp1,permke,' ') GOTO 1500

Copyright ©1995 to 2025 Software Validation Ltd. All rights reserved.