]> git.mdlowis.com Git - archive/tide-ocaml.git/commitdiff
added rule for generating lexers
authorMichael D. Lowis <mike@mdlowis.com>
Sat, 25 Nov 2017 03:39:17 +0000 (22:39 -0500)
committerMichael D. Lowis <mike@mdlowis.com>
Sat, 25 Nov 2017 03:39:17 +0000 (22:39 -0500)
Makefile
lib/lexers/lex_cpp.mll [moved from lib/lexers/cpp.mll with 97% similarity]

index 21f74373cc5fdb971652858422ade221f4251e67..d1b01945ce5e3af4e7be47c8b659a4dfd39420c0 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -55,13 +55,15 @@ LIBOBJS = \
 
 TESTOBJS = $(TESTSRCS:.ml=.$(OBJEXT))
 
-.PHONY: all clean docs
+.PHONY: all clean docs deps
 
 all: $(BINS)
        ./unittests.$(BINEXT)
 
 clean:
-       $(RM) *.byte *.bin *.cm* *.o *.a *.so lib/*.cm* lib/*.o tests/*.cm* tests/*.o
+       $(RM) *.byte *.bin *.cm* *.o *.a
+       $(RM) lib/*.cm* lib/*.o tests/*.cm* tests/*.o
+       $(RM) lib/lexers/*.cm* lib/lexers/*.ml
 
 # Executable targets
 edit.$(BINEXT): tide.$(LIBEXT) edit.$(OBJEXT)
@@ -73,13 +75,13 @@ docs: tide.$(LIBEXT)
        ocamldoc -d docs -html -I lib $(LIBSRCS)
 
 # Dependency generation
-deps.mk: $(wildcard *.ml* lib/*.ml* tests/*.ml*)
+deps deps.mk: $(wildcard *.ml* lib/*.ml* tests/*.ml*)
        ocamldep -I . -I lib/ -I tests/ -all -one-line $^ > deps.mk
 -include deps.mk
 
 # Implicit Rule Definitions
 #-------------------------------------------------------------------------------
-.SUFFIXES: .c .o .ml .mli .cmo .cmx .cmi .cma .cmxa .byte .bin
+.SUFFIXES: .c .o .ml .mli .mll .cmo .cmx .cmi .cma .cmxa .byte .bin
 .c.o:
        ocamlc $(OFLAGS) -c $^ $(INCS)
        mv $(notdir $@) $(dir $@)
@@ -89,6 +91,8 @@ deps.mk: $(wildcard *.ml* lib/*.ml* tests/*.ml*)
        ocamlopt -c $(OFLAGS) $(INCS) -o $@ $<
 .mli.cmi :
        ocamlc -c $(OFLAGS) $(INCS) -o $@ $<
+.mll.ml :
+       ocamllex $(OLEXFLAGS) -o $@ $<
 %.cma:
        ocamlmklib $(MKLIBFLAGS) $(OFLAGS) -o $* -oc $* $(LIBS) $^
 %.cmxa:
@@ -98,10 +102,7 @@ deps.mk: $(wildcard *.ml* lib/*.ml* tests/*.ml*)
 %.bin:
        ocamlopt $(OLDFLAGS) $(INCS) -o $@ $^
 
-# Lexer and parser generation
-#.mll.ml :
-#      ocamllex $(OLEXFLAGS) $<
 #.mly.ml :
-#      ocamlyacc $(OYACCFLAGS) $<
+#      ocamlyacc $(OYACCFLAGS) -o $@ $<
 #.mly.mli:
-#      ocamlyacc $(OYACCFLAGS) $<
+#      ocamlyacc $(OYACCFLAGS) -o $@ $<
similarity index 97%
rename from lib/lexers/cpp.mll
rename to lib/lexers/lex_cpp.mll
index 1c36298e69a7d05f6df26a582e7da9955d0aa9e7..b439bb570926b135d64ec569785232a08610b36e 100644 (file)
@@ -1,4 +1,4 @@
-{ open Highlight }
+(*{ open Highlight }*)
 
 (* Line and Block Comments *)
 let ln_cmt = "//" [^ '\r' '\n']*