Search code examples
awkmakefileflex-lexer

Error on unexpected bracket in gawk


I am trying to create a DiffMerge like app that will show me differences between Rhapsody diagrams more friendly.

I did some research and I found out that someone did a .sbs to .xml file convertor[1], which then can be parsed easily.

Now, when I try to compile the file using make all I get this error:

flex lexer.l
gawk "/#define YY_BUF_SIZE/{gsub(/16384/, "(1024*1024)")};{print}" lex.yy.c > lex.yy.c.new
/bin/sh: 1: Syntax error: "(" unexpected
make: *** [flex] Error 2

Could you help me solve this?

The files I used are on the Git link below.

Note: I commented the line with SHELL=... from Makefile because I'm working in Linux.

[1] https://github.com/PrzemekWirkus/sbs2xml-conv


Solution

  • Just change the "s around the script to 's (which they always should be anyway):

    gawk '/#define YY_BUF_SIZE/{gsub(/16384/, "(1024*1024)")};{print}' lex.yy.c > lex.yy.c.new