Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Add example2, example3

  • Loading branch information...
commit 4c89fa5566e7a00e85284664aa94873ebeb8fee5 1 parent 9c5f356
Toru Yamaguchi authored
4 .gitignore
@@ -3,5 +3,5 @@ CMakeFiles
3 3 Makefile
4 4 cmake_install.cmake
5 5 install_manifest.txt
6   -lex.yy.c
7   -example1
  6 +*.yy.c
  7 +example?
17 CMakeLists.txt
... ... @@ -1,6 +1,17 @@
1   -cmake_minimum_required (VERSION 2.6)
  1 +cmake_minimum_required (VERSION 2.8)
2 2 project (lex_yacc_howto)
3 3
  4 +find_package(BISON)
4 5 find_package(FLEX)
5   -FLEX_TARGET(Scanner example1.l ${CMAKE_CURRENT_BINARY_DIR}/lex.yy.cc)
6   -add_executable(example1 ${FLEX_Scanner_OUTPUTS})
  6 +
  7 +FLEX_TARGET(Example1Scanner example1.l ${CMAKE_CURRENT_BINARY_DIR}/example1.yy.c)
  8 +add_executable(example1 ${FLEX_Example1Scanner_OUTPUTS})
  9 +target_link_libraries(example1 fl)
  10 +
  11 +FLEX_TARGET(Example2Scanner example2.l ${CMAKE_CURRENT_BINARY_DIR}/example2.yy.c)
  12 +add_executable(example2 ${FLEX_Example2Scanner_OUTPUTS})
  13 +target_link_libraries(example2 fl)
  14 +
  15 +FLEX_TARGET(Example3Scanner example3.l ${CMAKE_CURRENT_BINARY_DIR}/example3.yy.c)
  16 +add_executable(example3 ${FLEX_Example3Scanner_OUTPUTS})
  17 +target_link_libraries(example3 fl)
8 example2.l
... ... @@ -0,0 +1,8 @@
  1 +%{
  2 +#include <stdio.h>
  3 +%}
  4 +
  5 +%%
  6 +[0123456789]+ printf("NUMBER\n");
  7 +[a-zA-Z][a-zA-Z0-9]* printf("WORD\n");
  8 +%%
14 example3.l
... ... @@ -0,0 +1,14 @@
  1 +%{
  2 +#include <stdio.h>
  3 +%}
  4 +
  5 +%%
  6 +[a-zA-Z][a-zA-Z0-9]* printf("WORD ");
  7 +[a-zA-Z0-9\/.-]+ printf("FILENAME ");
  8 +\" printf("QUOTE ");
  9 +\{ printf("OBRACE ");
  10 +\} printf("EBRACE ");
  11 +; printf("SEMICOLON ");
  12 +\n printf("\n");
  13 +[ \t]+ /* Ignore whitespaces */;
  14 +%%
9 example3.txt
... ... @@ -0,0 +1,9 @@
  1 +logging {
  2 + category lame-servers { null; };
  3 + category cname { null; };
  4 +};
  5 +
  6 +zone "." {
  7 + type hint;
  8 + file "/etc/bind/db.root";
  9 +};

0 comments on commit 4c89fa5

Please sign in to comment.
Something went wrong with that request. Please try again.