Char(3o) OCaml library Char(3o)NAME
Char - Character operations.
: sig end
val code : char -> int
Return the ASCII code of the argument.
val chr : int -> char
Return the character with the given ASCII code. Raise Invalid_argument Char.chr if the argument is outside the range 0--255.
val escaped : char -> string
Return a string representing the given character, with special characters escaped following the lexical conventions of Objective Caml.
val lowercase : char -> char
Convert the given character to its equivalent lowercase character.
val uppercase : char -> char
Convert the given character to its equivalent uppercase character.
type t = char
An alias for the type of characters.
val compare : t -> t -> int
The comparison function for characters, with the same specification as Pervasives.compare . Along with the type t , this function compare
allows the module Char to be passed as argument to the functors Set.Make and Map.Make .
OCamldoc 2012-06-26 Char(3o)
Check Out this Related Man Page
Genlex(3) OCaml library Genlex(3)NAME
Genlex - A generic lexical analyzer.
: sig end
A generic lexical analyzer.
This module implements a simple ``standard'' lexical analyzer, presented as a function from character streams to token streams. It imple-
ments roughly the lexical conventions of OCaml, but is parameterized by the set of keywords of your language.
Example: a lexer suitable for a desk calculator is obtained by let lexer = make_lexer ["+";"-";"*";"/";"let";"="; ( ; ) ]
The associated parser would be a function from token stream to, for instance, int , and would have rules such as:
let parse_expr = parser [< 'Int n >] -> n | [< 'Kwd ( ; n = parse_expr; 'Kwd ) >] -> n | [< n1 = parse_expr; n2 = parse_remainder n1 >] ->
n2 and parse_remainder n1 = parser [< 'Kwd + ; n2 = parse_expr >] -> n1+n2 | ...
One should notice that the use of the parser keyword and associated notation for streams are only available through camlp4 extensions. This
means that one has to preprocess its sources e. g. by using the -pp command-line switch of the compilers.
type token =
| Kwd of string
| Ident of string
| Int of int
| Float of float
| String of string
| Char of char
The type of tokens. The lexical classes are: Int and Float for integer and floating-point numbers; String for string literals, enclosed in
double quotes; Char for character literals, enclosed in single quotes; Ident for identifiers (either sequences of letters, digits, under-
scores and quotes, or sequences of ``operator characters'' such as + , * , etc); and Kwd for keywords (either identifiers or single ``spe-
cial characters'' such as ( , } , etc).
val make_lexer : string list -> char Stream.t -> token Stream.t
Construct the lexer function. The first argument is the list of keywords. An identifier s is returned as Kwd s if s belongs to this list,
and as Ident s otherwise. A special character s is returned as Kwd s if s belongs to this list, and cause a lexical error (exception
Parse_error ) otherwise. Blanks and newlines are skipped. Comments delimited by (* and *) are skipped as well, and can be nested.
OCamldoc 2014-06-09 Genlex(3)
I want to write a shell script in order to retreive some data from a log file that i have written into.
The string that i want to get is the number 2849 (that is located between | | ).
To explain further, this is the result i get after running "grep LOGIN filename.log" but i need to get the... (25 Replies)
Environment: Sun UNIX
Language: Bourne Shell
I am writing a script that allows user to key in a directory. Example: /root/tmp.
Since the user can key in anything he/she wants, I need to validate to make sure that he/she does not key in anything funny i.e.... (37 Replies)
I've a csv file seperated by '|' from which I'm trying to remove the excess '|' characters more than the existing fields. My CSV looks like as below.
10000001|ACTIVE|Testazar1|Testore1|20041|||... (24 Replies)
Hi Unix Guru,
I have an requirement for replace some specail characters in a file, my file came from mainframe.
please see below example:
when open it with vi
17896660|89059215|04/24/1998 00:00:00.000000| abc 123-453-1312^M<85>^M<85>|124557
if I run cat -v I got following:... (25 Replies)
I have the file which has the data :
ccctaaccctaaccctaaccctaaccctaacccctaaccctaaccctaaa... (24 Replies)
I have tried in vain to find a solution for this problem - I'm trying to replace any double quotes within a quoted string with a single quote, leaving everything else as is.
I have the following data:
... (32 Replies)
First find the special character, from the special character take next two bytes convert the bytes to decimal and replace with next present byte of decimal value times.
Output: 302619(3 spaces for ú1A)??????????????????????????
Dines (27 Replies)
This seems like it should be an easy problem, but for some reason I am struggling with the solution.
I simply want to replace all characters after the first 3 characters with another character, preferably with sed.
Thanks in advance.
Like this, but producing the proper number of *'s:
sed... (30 Replies)
I am trying to grep for a particular text (Do action on cell BL330) in a text file(sample.gz) which is searched in the content filtered by date+timestamp (2016-09-14 01:09:56,796 to 2016-09-15 04:10:29,719) on a remote machine and finally write the output into a output file on a local machine.
... (23 Replies)
I am on AIX.
When I encounter extended ascii characters and special characters on a file I need to print..
Byte position, actual character and line number.
Is there a simple command that can give me the above result ?
Thanks in advance (38 Replies)
I have a file in unix with 15 columns.It consists special characters(#,$,^M,@,*,% etc)at the end of the each record.I want to remove these special characters.I used the following:
Sed -e 's/ /g;s/ */ /g'
. But It is removing special characters exists everywhere in the file(begining,middle... (24 Replies)
I'm trying to delete a file with a weird name from within Terminal on a Mac.
It's a very old file (1992) with null characters in the name: ââWord FinderÂŽ Plusâ˘.
Here are some examples of what I've tried:
12FX009:5 dpontius$ ls
ââWord FinderÂŽ Plusâ˘
12FX009:5 dpontius$ rm... (29 Replies)