package morbig
Source file token.ml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65(**************************************************************************) (* -*- tuareg -*- *) (* *) (* Copyright (C) 2017,2018,2019 Yann Régis-Gianas, Nicolas Jeannerod, *) (* Ralf Treinen. *) (* *) (* This is free software: you can redistribute it and/or modify it *) (* under the terms of the GNU General Public License, version 3. *) (* *) (* Additional terms apply, due to the reproduction of portions of *) (* the POSIX standard. Please refer to the file COPYING for details. *) (**************************************************************************) open CST open CSTHelpers open Parser let string_of_hd hd = unWord hd.value let string_of_io_number (IONumber io) = io let string_of_assignment_word aw = unWord (word_of_assignment_word aw) let string_of_token = function | EOF -> "EOF" | AND_IF -> "AND_IF" | OR_IF -> "OR_IF" | DSEMI -> "DSEMI" | DLESS wr -> Printf.sprintf "DLESS(%s)" (string_of_hd !wr) | DLESSDASH wr -> Printf.sprintf "DLESSDASH(%s)" (string_of_hd !wr) | CLOBBER -> ">|" | If -> "If" | Then -> "Then" | Else -> "Else" | Fi -> "Fi" | Elif -> "Elif" | LESSGREAT -> "LESSGREAT" | LESSAND -> "LESSAND" | DGREAT -> "DGREAT" | GREATAND -> "GREATAND" | WORD w -> Printf.sprintf "WORD(%s)" (unWord w) | ASSIGNMENT_WORD w -> Printf.sprintf "ASSIGNMENT_WORD(%s)" (string_of_assignment_word w) | NAME w -> Printf.sprintf "NAME(%s)" (unName w) | IO_NUMBER io -> Printf.sprintf "IONUMBER(%s)" (string_of_io_number io) | Do -> "Do" | Done -> "Done" | Case -> "Case" | Esac -> "Esac" | While -> "While" | Until -> "Until" | For -> "For" | Lbrace -> "Lbrace" | Rbrace -> "Rbrace" | Bang -> "Bang" | In -> "In" | Pipe -> "Pipe" | Lparen -> "Lparen" | Rparen -> "Rparen" | LESS -> "LESS" | GREAT -> "GREAT" | Uppersand -> "Uppersand" | Semicolon -> "Semicolon" | NEWLINE -> "Newline" | INTENDED_ERROR -> "INTENDED_ERROR"