lex for Chinese character


 
Thread Tools Search this Thread
Operating Systems Linux lex for Chinese character
# 1  
Old 03-16-2006
lex for Chinese character

Hi,
I need to read one chinese char using lex. I tried using "." ( period ) for pattern matching but in vain.
Could anyone suggest me how do i proceeed.
Sample pgm: to read a chinese char in single quotes.
%{
#include <locale.h>
%}
%%
\'.\' printf("SUCCESS\n");
. printf("Failed\n");
}
%%
main()
{
setlocale(LC_ALL,"");
yylex();
}
This always prints me "Failed" message. I cannot use '.+' for matching for my application.
I can view the chinese char with locale settings on my machine. I am using linux machine . Locale set is : zh_CN.utf8.

Thank You
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Lex: concatenating word into array of c-strings

Alright, so I'm writing a file for the lexical analyzer (lex). It will be used to check C code (collecting the identifiers and storing those names along with the line numbers the identifier was found on). I'm not used to 'C' so I'm having some difficulty. I am using a function (insertId()) to... (4 Replies)
Discussion started by: D2K
4 Replies

2. UNIX for Dummies Questions & Answers

Match newline character "\n" in lex

Hi everyone! This is my very first post, sorry if I'm not posting in the right category. I'm trying to match a newline "/n" using lex/yacc. For example, print(9,'\n',8) should print 9 8 now do I write a regular expression to match exactly " '\n' " Thanks! (1 Reply)
Discussion started by: code21
1 Replies

3. Programming

Netbeans ide can't display chinese character in linux

When i write the source code in netbeans environment,if the source code,there are chinese characters,chinese characters will be displayed as box,how to solve this problem?please (2 Replies)
Discussion started by: fang_xiaoan
2 Replies

4. Programming

actions before parsing rules in lex n yacc

Hi , We have developed a grammer for our domain language using lex n yacc. I want to know is there any pre defined lex-yacc function which gets call before executing any rule (or rules). Oue requirement is, before processing any rule ,we want to perform some specific actions ? is there... (0 Replies)
Discussion started by: supritjain
0 Replies

5. Programming

How to match n number of newline character(\n) in lex and yacc

Hi , I need to develop a parser which should match something like 1. text a=5 " a=20"; 2. text a=..." a=20"; 3 text a=..." a=20 b=34 c=12 "; I have used this regular expression in my Lex file to generate the tokens: \".\s*.*\s.\" (8 Replies)
Discussion started by: vishwa787
8 Replies

6. Solaris

lex on solaris??? (urgent, pls!!!)

Hi everyone, I would like to know how to compile and run lex programs on solaris 10. the conventional way is $ lex <name.l> $ cc lex.yy.c -ll $ ./a.out but while trying to execute the 2nd command :i get a reference saying that the command is old or that main is not supported... Hence... (1 Reply)
Discussion started by: wrapster
1 Replies

7. Programming

regarding lex regular expression

Hi all I am using lex for my application scanning and I need to skip some lines for which I don't know the exact pattern. So, could anybody tell me the regular expression to display lines NOT beginning with the specified pattern. I know how to display lines beginning with the... (1 Reply)
Discussion started by: axes
1 Replies

8. Programming

Multiple scanners on same input file using lex/flex

Hi all, I'm working with flex (version 2.5.4a) on GNU/linux. I used it to develop 4 scanner C files for matching different patterns within an input file. But the problem now on my hand is that I need to conditionally combine these. That is in main (placed in a separate C file other than the 4... (5 Replies)
Discussion started by: Rakesh Ranjan
5 Replies

9. Shell Programming and Scripting

help with cshell script to read 1 or more lex files

taskes one or more .l files and compiles them #!/usr/bin/csh #while loop to carry on asking user to enter the files while $number!=0 echo "enter file name" #check to see if file ends with .l #if file ends with .l compile lexx.yy.c file for each file this is how i think it needs... (1 Reply)
Discussion started by: homerj546
1 Replies

10. Shell Programming and Scripting

probs compiling lex

this is my lex file ------------ test.l %% printf("%c",yytext+'a'-'A');.ECHO; how do i compile it $ lex test.l cc lex.yy.c -o test -ll <------| | if this is correct do i add this line--------| @the command line or does it... (0 Replies)
Discussion started by: sinner
0 Replies
Login or Register to Ask a Question
FLEX(1) 							   User Commands							   FLEX(1)

NAME
flex - the fast lexical analyser generator SYNOPSIS
flex [OPTIONS] [FILE]... DESCRIPTION
Generates programs that perform pattern-matching on text. Table Compression: -Ca, --align trade off larger tables for better memory alignment -Ce, --ecs construct equivalence classes -Cf do not compress tables; use -f representation -CF do not compress tables; use -F representation -Cm, --meta-ecs construct meta-equivalence classes -Cr, --read use read() instead of stdio for scanner input -f, --full generate fast, large scanner. Same as -Cfr -F, --fast use alternate table representation. Same as -CFr -Cem default compression (same as --ecs --meta-ecs) Debugging: -d, --debug enable debug mode in scanner -b, --backup write backing-up information to lex.backup -p, --perf-report write performance report to stderr -s, --nodefault suppress default rule to ECHO unmatched text -T, --trace flex should run in trace mode -w, --nowarn do not generate warnings -v, --verbose write summary of scanner statistics to stdout Files: -o, --outfile=FILE specify output filename -S, --skel=FILE specify skeleton file -t, --stdout write scanner on stdout instead of lex.yy.c --yyclass=NAME name of C++ class --header-file=FILE create a C header file in addition to the scanner --tables-file[=FILE] write tables to FILE Scanner behavior: -7, --7bit generate 7-bit scanner -8, --8bit generate 8-bit scanner -B, --batch generate batch scanner (opposite of -I) -i, --case-insensitive ignore case in patterns -l, --lex-compat maximal compatibility with original lex -X, --posix-compat maximal compatibility with POSIX lex -I, --interactive generate interactive scanner (opposite of -B) --yylineno track line count in yylineno Generated code: -+, --c++ generate C++ scanner class -Dmacro[=defn] #define macro defn (default defn is '1') -L, --noline suppress #line directives in scanner -P, --prefix=STRING use STRING as prefix instead of "yy" -R, --reentrant generate a reentrant C scanner --bison-bridge scanner for bison pure parser. --bison-locations include yylloc support. --stdinit initialize yyin/yyout to stdin/stdout --noansi-definitions old-style function definitions --noansi-prototypes empty parameter list in prototypes --nounistd do not include <unistd.h> --noFUNCTION do not generate a particular FUNCTION Miscellaneous: -c do-nothing POSIX option -n do-nothing POSIX option -? -h, --help produce this help message -V, --version report flex version SEE ALSO
The full documentation for flex is maintained as a Texinfo manual. If the info and flex programs are properly installed at your site, the command info flex should give you access to the complete manual. flex 2.5.36 July 2012 FLEX(1)