#(f?)lex (39)
(f?)lex (39)
File inc.l:
%%
[0-9]+ printf("%d",atoi(yytext)+1);
Compile:
$ flex inc.l
$ gcc lex.yy.c -o inc -lfl
Run:
$ echo 'teststring134this 123test string54 100' | ./inc
teststring135this 124test string55 101
$ i='(-: 2 empty bottles of beer :-)'
$ tty=$(tty)
$ for n in {2..5} ; do i=$(./inc<<<$i|tee $tty) ; done
(-: 3 empty bottles of beer :-)
(-: 4 empty bottles of beer :-)
(-: 5 empty bottles of beer :-)
(-: 6 empty bottles of beer :-)
I did not test this with the original lex. Comments are welcome.
#(f?)lex (39)
File inc.l:
%%
[0-9]+ printf("%d",atoi(yytext)+1);
Compile:
$ flex inc.l
$ gcc lex.yy.c -o inc -lfl
Run:
$ echo 'teststring134this 123test string54 100' | ./inc
teststring135this 124test string55 101
$ i='(-: 2 empty bottles of beer :-)'
$ tty=$(tty)
$ for n in {2..5} ; do i=$(./inc<<<$i|tee $tty) ; done
(-: 3 empty bottles of beer :-)
(-: 4 empty bottles of beer :-)
(-: 5 empty bottles of beer :-)
(-: 6 empty bottles of beer :-)
I did not test this with the original lex. Comments are welcome.
(f?)lex (39)
File inc.l:
%%
[0-9]+ printf("%d",atoi(yytext)+1);
Compile:
$ flex inc.l
$ gcc lex.yy.c -o inc -lfl
Run:
$ echo 'teststring134this 123test string54 100' | ./inc
teststring135this 124test string55 101
$ i='(-: 2 empty bottles of beer :-)'
$ tty=$(tty)
$ for n in {2..5} ; do i=$(./inc<<<$i|tee $tty) ; done
(-: 3 empty bottles of beer :-)
(-: 4 empty bottles of beer :-)
(-: 5 empty bottles of beer :-)
(-: 6 empty bottles of beer :-)
I did not test this with the original lex. Comments are welcome.
#(f?)lex (4139)
File inc.l (no trailing new line):
%%
[0-9]+ printf("%d",atoi(yytext)+1);
%%
Compile:
$ flex inc.l
$ gcc lex.yy.c -o inc -lfl
Run:
$ echo 'teststring134this 123test string54 100' | ./inc
teststring135this 124test string55 101
$ i='(-: 2 empty bottles of beer :-)'
$ tty=$(tty)
$ for n in {2..5} ; do i=$(./inc<<<$i|tee $tty) ; done
(-: 3 empty bottles of beer :-)
(-: 4 empty bottles of beer :-)
(-: 5 empty bottles of beer :-)
(-: 6 empty bottles of beer :-)
I did not test this with the original lex. Comments are welcome.
#(f?)lex (41)
File inc.l (no trailing new line):
%%
[0-9]+ printf("%d",atoi(yytext)+1);
%%
Compile:
$ flex inc.l
$ gcc lex.yy.c -o inc -lfl
Run:
$ echo 'teststring134this 123test string54 100' | ./inc
teststring135this 124test string55 101
$ i='(-: 2 empty bottles of beer :-)'
$ tty=$(tty)
$ for n in {2..5} ; do i=$(./inc<<<$i|tee $tty) ; done
(-: 3 empty bottles of beer :-)
(-: 4 empty bottles of beer :-)
(-: 5 empty bottles of beer :-)
(-: 6 empty bottles of beer :-)
I did not test this with the original lex. Comments are welcome.
#(f?)lex (39)
File inc.l:
%%
[0-9]+ printf("%d",atoi(yytext)+1);
Compile:
$ flex inc.l
$ gcc lex.yy.c -o inc -lfl
Run:
$ echo 'teststring134this 123test string54 100' | ./inc
teststring135this 124test string55 101
$ i='(-: 2 empty bottles of beer :-)'
$ tty=$(tty)
$ for n in {2..5} ; do i=$(./inc<<<$i|tee $tty) ; done
(-: 3 empty bottles of beer :-)
(-: 4 empty bottles of beer :-)
(-: 5 empty bottles of beer :-)
(-: 6 empty bottles of beer :-)
I did not test this with the original lex. Comments are welcome.
#(f?)lex (41)
Not a candidate for winning this golfing, but I think (f?)lex deserves some attention... ;-)
File inc.l (no trailing new line):
%%
[0-9]+ printf("%d",atoi(yytext)+1);
%%
Compile:
$ flex inc.l
$ gcc lex.yy.c -o inc -lfl
Run:
$ echo 'teststring134this 123test string54 100' | ./inc
teststring135this 124test string55 101
$ i='(-: 2 empty bottles of beer :-)'
$ tty=$(tty)
$ for n in {2..5} ; do i=$(./inc<<<$i|tee $tty) ; done
(-: 3 empty bottles of beer :-)
(-: 4 empty bottles of beer :-)
(-: 5 empty bottles of beer :-)
(-: 6 empty bottles of beer :-)
I did not test this with the original lex. Comments are welcome.
#(f?)lex (41)
Not a candidate for winning this golfing, but I think (f?)lex deserves some attention... ;-)
File inc.l (no trailing new line):
%%
[0-9]+ printf("%d",atoi(yytext)+1);
%%
Compile:
$ flex inc.l
$ gcc lex.yy.c -o inc -lfl
Run:
$ echo 'teststring134this 123test string54 100' | ./inc
teststring135this 124test string55 101
$ i='(-: 2 empty bottles of beer :-)'
$ tty=$(tty)
$ for n in {2..5} ; do i=$(./inc<<<$i|tee $tty) ; done
(-: 3 empty bottles of beer :-)
(-: 4 empty bottles of beer :-)
(-: 5 empty bottles of beer :-)
(-: 6 empty bottles of beer :-)
I did not test this with the original lex. Comments are welcome.
#(f?)lex (41)
File inc.l (no trailing new line):
%%
[0-9]+ printf("%d",atoi(yytext)+1);
%%
Compile:
$ flex inc.l
$ gcc lex.yy.c -o inc -lfl
Run:
$ echo 'teststring134this 123test string54 100' | ./inc
teststring135this 124test string55 101
$ i='(-: 2 empty bottles of beer :-)'
$ tty=$(tty)
$ for n in {2..5} ; do i=$(./inc<<<$i|tee $tty) ; done
(-: 3 empty bottles of beer :-)
(-: 4 empty bottles of beer :-)
(-: 5 empty bottles of beer :-)
(-: 6 empty bottles of beer :-)
I did not test this with the original lex. Comments are welcome.