File: clean-bibtex.R

package info (click to toggle)
r-cran-bibtex 0.4.2-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 552 kB
  • sloc: yacc: 828; lex: 599; ansic: 108; sh: 13; makefile: 7
file content (14 lines) | stat: -rw-r--r-- 469 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
lines <- readLines( "bibtex/src/biblex.c" )

# remove declaration of yy_fatal_error
decl <- grep("static void yy_fatal_error.*;", lines)
lines[decl] <- paste( "//", lines[decl] )

# first line of definition of yy_fatal_error
def_begin <- grep("static void yy_fatal_error[^;]*$", lines )
def_end <- def_begin + grep( "^}", tail(lines, -def_begin) )[1L]

lines[ def_begin:def_end ] <- paste( "// ", lines[def_begin:def_end] )

writeLines( lines, "bibtex/src/biblex.c" )