diff --git a/CHANGELOG.md b/CHANGELOG.md index 2381d0b85..e44920054 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,16 +2,15 @@ All notable changes to this project will be documented in this file. -The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) -and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). +The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). -## [Unreleased] +## [0.0.3] - 2018-10-09 ### Fixed -- Does NOT insert spacing between different scripts when the line breaking class of the posterior charcter is CL, CP, QU, NS, JLCP, JLNS, JLCM, or JLFS +- Does NOT insert spacing between different scripts when the [line breaking class](http://unicode.org/reports/tr14/) of the posterior charcter is CL, CP, QU, NS, JLCP, JLNS, JLCM, or JLFS. -# Changed -- Supports the application of math commands to optional arguments -- Add `set-space-ratio-between-scripts` and `get-space-ratio-between-scripts` +# Added +- Supports the application of math commands to optional arguments. +- Provides primitives `set-space-ratio-between-scripts` and `get-space-ratio-between-scripts`. ## [0.0.2] - 2018-08-09 ### Fixed diff --git a/Makefile b/Makefile index 275511c28..bd10e4245 100644 --- a/Makefile +++ b/Makefile @@ -76,20 +76,6 @@ install: $(TARGET) #preliminary: # [ -d .git ] && git submodule update -i || echo "Skip git submodule update -i" -lib: -# -- downloads fonts -- - mkdir -p temp/ - if [ -x "$$(command -v curl)" ]; then \ - curl -R -o temp/lm2.004otf.zip http://www.gust.org.pl/projects/e-foundry/latin-modern/download/lm2.004otf.zip; \ - curl -R -o temp/latinmodern-math-1959.zip http://www.gust.org.pl/projects/e-foundry/lm-math/download/latinmodern-math-1959.zip; \ - else \ - wget -N http://www.gust.org.pl/projects/e-foundry/latin-modern/download/lm2.004otf.zip -P temp/; \ - wget -N http://www.gust.org.pl/projects/e-foundry/lm-math/download/latinmodern-math-1959.zip -P temp/; \ - fi - unzip -o temp/lm2.004otf.zip -d lib-satysfi/dist/fonts/ - unzip -o temp/latinmodern-math-1959.zip -d temp/ - cp temp/latinmodern-math-1959/otf/latinmodern-math.otf lib-satysfi/dist/fonts/ - uninstall: rm -rf $(BINDIR)/$(TARGET) rm -rf $(LIBDIR) diff --git a/README-ja.md b/README-ja.md index 8e5bb73cf..46ac702aa 100644 --- a/README-ja.md +++ b/README-ja.md @@ -31,7 +31,7 @@ $ brew install --HEAD nyuichi/satysfi/satysfi * unzip * wget or curl * ruby -* [opam](https://opam.ocaml.org/) 1.2 (インストール手順は[こちら](https://opam.ocaml.org/doc/Install.html)。) +* [opam](https://opam.ocaml.org/) 2.0 (インストール手順は[こちら](https://opam.ocaml.org/doc/Install.html)。) * ocaml 4.06.0 (OPAM からインストールします) また,ビルドには外部 OPAM リポジトリの追加が必要です。これは以下のコマンドでできます。 @@ -45,14 +45,15 @@ opam update ```sh sudo apt-get update -sudo apt-get install build-essential git m4 unzip wget +sudo apt-get install build-essential git m4 unzip curl + +sh <(curl -sL https://raw.githubusercontent.com/ocaml/opam/master/shell/install.sh) # 以下のコマンドは OPAM がファイルに追記してもよいか聞いてきます。 # 必ず説明を読み,環境変数を適切に設定してください。 -wget https://raw.github.com/ocaml/opam/master/shell/opam_installer.sh -O - | sh -s /usr/local/bin +opam init --comp 4.06.0 -opam switch 4.06.0 -eval `opam config env` +eval $(opam env) opam repository add satysfi-external https://github.com/gfngfn/satysfi-external-repo.git opam update @@ -69,10 +70,9 @@ brew install opam # 以下のコマンドは OPAM が(~/.bash_profile などの)ファイルに環境変数に関する設定を追記してもよいか聞いてきます。 # 必ず説明を読み,環境変数を適切に設定してください。 -opam init +opam init --comp 4.06.0 -opam switch 4.06.0 -eval `opam config env` +eval $(opam env) opam repository add satysfi-external https://github.com/gfngfn/satysfi-external-repo.git opam update diff --git a/README.md b/README.md index 7cb081ea4..76e19db87 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ Here is a list of minimally required softwares. * unzip * wget or curl * ruby -* [opam](https://opam.ocaml.org/) 1.2 (Installation instructions are [here](https://opam.ocaml.org/doc/Install.html).) +* [opam](https://opam.ocaml.org/) 2.0 (Installation instructions are [here](https://opam.ocaml.org/doc/Install.html).) * ocaml 4.06.0 (installed by OPAM) Also, we must add an external OPAM repo to build. This can be done by the following command. @@ -44,14 +44,15 @@ opam update ```sh sudo apt-get update -sudo apt-get install build-essential git m4 unzip wget +sudo apt-get install build-essential git m4 unzip curl + +sh <(curl -sL https://raw.githubusercontent.com/ocaml/opam/master/shell/install.sh) # The following command will ask if you allow OPAM to modify some files (e.g. ~/.bash_profile). # Be sure to read its instructions. Otherwise, some environment variables won't be set. -wget https://raw.github.com/ocaml/opam/master/shell/opam_installer.sh -O - | sh -s /usr/local/bin +opam init --comp 4.06.0 -opam switch 4.06.0 -eval `opam config env` +eval $(opam env) opam repository add satysfi-external https://github.com/gfngfn/satysfi-external-repo.git opam update @@ -68,10 +69,9 @@ brew install opam # The following command will ask if OPAM modifies some files. # Be sure to read their instructions. Otherwise, some environment variables won't be set. -opam init +opam init --comp 4.06.0 -opam switch 4.06.0 -eval `opam config env` +eval $(opam env) opam repository add satysfi-external https://github.com/gfngfn/satysfi-external-repo.git opam update diff --git a/lib-satysfi/dist/packages/standalone.satyh b/lib-satysfi/dist/packages/standalone.satyh index 450a9ab84..d6eb47de6 100644 --- a/lib-satysfi/dist/packages/standalone.satyh +++ b/lib-satysfi/dist/packages/standalone.satyh @@ -6,6 +6,7 @@ let standalone bt = let ctx = get-initial-context 440pt (command \math) |> set-dominant-narrow-script Latin + |> set-dominant-wide-script Kana in let bb = read-block ctx bt in page-break A4Paper diff --git a/lib-satysfi/dist/packages/stdjareport.satyh b/lib-satysfi/dist/packages/stdjareport.satyh new file mode 100644 index 000000000..aa2cbfc63 --- /dev/null +++ b/lib-satysfi/dist/packages/stdjareport.satyh @@ -0,0 +1,406 @@ +% -*- coding: utf-8 -*- +@require: pervasives +@require: gr +@require: list +@require: math +@require: color +@require: footnote-scheme + + +module StdJaReport : sig + + val document : 'a -> block-text -> document + constraint 'a :: (| + title : inline-text; + author : inline-text; + |) + + val font-latin-roman : string * float * float + val font-latin-italic : string * float * float + val font-latin-sans : string * float * float + val font-latin-mono : string * float * float + val font-cjk-mincho : string * float * float + val font-cjk-gothic : string * float * float + val set-latin-font : (string * float * float) -> context -> context + val set-cjk-font : (string * float * float) -> context -> context + direct \ref : [string] inline-cmd + direct \ref-page : [string] inline-cmd + direct \figure : [string?; inline-text; block-text] inline-cmd + direct +p : [inline-text] block-cmd + direct +section : [string?; inline-text; block-text] block-cmd + direct +subsection : [string?; inline-text; block-text] block-cmd + direct \emph : [inline-text] inline-cmd + direct \dfn : [inline-text] inline-cmd + direct \footnote : [inline-text] inline-cmd + +end = struct + + type toc-element = + | TOCElementSection of string * inline-text + | TOCElementSubsection of string * inline-text + + + let generate-fresh-label = + let-mutable count <- 0 in + (fun () -> ( + let () = count <- !count + 1 in + `generated:` ^ (arabic (!count)) + )) + + + let-inline ctx \ref key = + let opt = get-cross-reference (key ^ `:num`) in + let it = + match opt with + | None -> {?} + | Some(s) -> embed-string s + in + read-inline ctx it + + + let-inline ctx \ref-page key = + let opt = get-cross-reference (key ^ `:page`) in + let it = + match opt with + | None -> {?} + | Some(s) -> embed-string s + in + read-inline ctx it + + + let font-size-normal = 12pt + let font-size-title = 18pt + let font-size-author = 16pt + let font-size-section = 18pt + let font-size-subsection = 16pt + + let section-top-margin = 20pt + let section-bottom-margin = 12pt + + let font-ratio-latin = 1. + let font-ratio-cjk = 0.88 + + let font-latin-roman = (`Junicode` , font-ratio-latin, 0.) + let font-latin-italic = (`Junicode-it`, font-ratio-latin, 0.) + let font-latin-sans = (`lmsans` , font-ratio-latin, 0.) + let font-latin-mono = (`lmmono` , font-ratio-latin, 0.) + let font-cjk-mincho = (`ipaexm` , font-ratio-cjk , 0.) + let font-cjk-gothic = (`ipaexg` , font-ratio-cjk , 0.) + + + let set-latin-font font ctx = + ctx |> set-font Latin font + + + let set-cjk-font font ctx = + ctx |> set-font HanIdeographic font + |> set-font Kana font + + + let get-standard-context wid = + get-initial-context wid (command \math) + |> set-dominant-wide-script Kana + |> set-language Kana Japanese + |> set-language HanIdeographic Japanese + |> set-dominant-narrow-script Latin + |> set-language Latin English + |> set-font Kana font-cjk-mincho + |> set-font HanIdeographic font-cjk-mincho + |> set-font Latin font-latin-roman + |> set-math-font `lmodern` + |> set-hyphen-penalty 100 + + + let-mutable ref-float-boxes <- [] + + + let height-of-float-boxes pageno = +% let () = display-message `get height` in + (!ref-float-boxes) |> List.fold-left (fun h (pn, bb) -> ( + if pn < pageno then h +' (get-natural-length bb) else h + )) 0pt + + + let-mutable ref-figure <- 0 + + + let-inline ctx \figure ?:labelopt caption inner = + let () = ref-figure <- !ref-figure + 1 in + let s-num = arabic (!ref-figure) in + let () = + match labelopt with + | Some(label) -> register-cross-reference (label ^ `:num`) s-num + | None -> () + in + let it-num = embed-string s-num in + let bb-inner = + let d (_, _) _ _ _ = [] in + block-frame-breakable ctx (2pt, 2pt, 2pt, 2pt) (d, d, d, d) (fun ctx -> ( + read-block ctx inner + +++ line-break true true ctx (inline-fil ++ read-inline ctx {図#it-num; #caption;} ++ inline-fil) + )) + in + hook-page-break (fun pbinfo _ -> ( +% let () = display-message (`register` ^ (arabic pbinfo#page-number)) in + ref-float-boxes <- (pbinfo#page-number, bb-inner) :: !ref-float-boxes + )) + + + let make-section-title ctx = + ctx |> set-font-size font-size-section + |> set-font Latin font-latin-sans + |> set-cjk-font font-cjk-gothic + + + let make-subsection-title ctx = + ctx |> set-font-size font-size-subsection + |> set-font Latin font-latin-sans + |> set-cjk-font font-cjk-gothic + + + let-mutable toc-acc-ref <- [] + + + let get-cross-reference-number label = + match get-cross-reference (label ^ `:num`) with + | None -> `?` + | Some(s) -> s + + + let get-cross-reference-page label = + match get-cross-reference (label ^ `:page`) with + | None -> `?` + | Some(s) -> s + + + let section-heading ctx ib-heading = + line-break true false + (ctx |> set-paragraph-margin section-top-margin section-bottom-margin) + ib-heading + + + let-inline ctx \dummy it = + let ib = read-inline (ctx |> set-text-color Color.white) it in + let w = get-natural-width ib in + ib ++ inline-skip (0pt -' w) + + + let document record inner = + % -- constants -- + let title = record#title in + let author = record#author in + let page = A4Paper in + let txtorg = (80pt, 100pt) in + let txtwid = 440pt in + let txthgt = 630pt in + let hdrorg = (40pt, 30pt) in + let ftrorg = (40pt, 780pt) in + let hdrwid = 520pt in + let ftrwid = 520pt in + + let () = + register-cross-reference `changed` `F` + in + + let ctx-doc = get-standard-context txtwid in + + % -- title -- + let bb-title = + let bb-title-main = + let ctx = + ctx-doc |> set-font-size font-size-title + in + line-break false false ctx + (inline-fil ++ read-inline ctx title ++ inline-fil) + in + let bb-author = + let ctx = + ctx-doc |> set-font-size font-size-author + in + line-break false false ctx + (inline-fil ++ read-inline ctx author ++ inline-fil) + in + bb-title-main +++ bb-author + in + + % -- main -- + let bb-main = read-block ctx-doc inner in + + % -- page settings -- + let pagecontf pbinfo = + let () = FootnoteScheme.start-page () in + let hgtfb = height-of-float-boxes pbinfo#page-number in + let (txtorgx, txtorgy) = txtorg in + (| + text-origin = (txtorgx, txtorgy +' hgtfb); + text-height = txthgt -' hgtfb; + |) + in + let pagepartsf pbinfo = + let pageno = pbinfo#page-number in + let header = + let ctx = + get-standard-context hdrwid + |> set-paragraph-margin 0pt 0pt + in + let ib-text = + if pageno mod 2 == 0 then + (inline-fil ++ read-inline ctx title) + else + (read-inline ctx title ++ inline-fil) + in +% let () = display-message `insert` in + let (bb-float-boxes, acc) = + (!ref-float-boxes) |> List.fold-left (fun (bbacc, acc) elem -> ( + let (pn, bb) = elem in + if pn < pageno then + let bbs = + line-break true true (ctx |> set-paragraph-margin 0pt 12pt) + (inline-fil ++ embed-block-top ctx txtwid (fun _ -> bb) ++ inline-fil) + % 'ctx' is a dummy context + in + (bbacc +++ bbs, acc) + else + (bbacc, elem :: acc) + )) (block-nil, []) + in + let () = ref-float-boxes <- acc in + bb-float-boxes + in + let footer = + let ctx = get-standard-context ftrwid in + let it-pageno = embed-string (arabic pbinfo#page-number) in + line-break true true ctx + (inline-fil ++ (read-inline ctx {— #it-pageno; —}) ++ inline-fil) + in + (| + header-origin = hdrorg; + header-content = header; + footer-origin = ftrorg; + footer-content = footer; + |) + in + page-break page pagecontf pagepartsf (bb-title +++ bb-main) + + + let-mutable needs-indentation-ref <- true + + let-mutable num-section <- 0 + let-mutable num-subsection <- 0 + + + let quad-indent ctx = + inline-skip (get-font-size ctx *' font-ratio-cjk) + + + let-block ctx +p inner = + let needs-indentation = + if !needs-indentation-ref then true else + let () = needs-indentation-ref <- true in + false + in + let ib-inner = read-inline ctx inner in + let ib-parag = + if needs-indentation then + (quad-indent ctx) ++ ib-inner ++ inline-fil + else + ib-inner ++ inline-fil + in + form-paragraph ctx ib-parag + + + let section-scheme ctx label title inner = + let ctx-title = make-section-title ctx in + let () = increment num-section in + let () = num-subsection <- 0 in + let s-num = arabic (!num-section) in + let () = register-cross-reference (`section:` ^ label ^ `:num`) s-num in + let () = toc-acc-ref <- (TOCElementSection(label, title)) :: !toc-acc-ref in + let ib-num = + read-inline ctx-title (embed-string (s-num ^ `.`)) + ++ hook-page-break (fun pbinfo _ -> ( + let pageno = pbinfo#page-number in + register-cross-reference (`section:` ^ label ^ `:page`) (arabic pageno))) + in + let ib-title = read-inline ctx-title title in + let bb-title = section-heading ctx (ib-num ++ (inline-skip 10pt) ++ ib-title ++ (inline-fil)) in + let bb-inner = read-block ctx inner in + bb-title +++ bb-inner + + + let subsection-scheme ctx label title inner = + let () = num-subsection <- !num-subsection + 1 in + let () = needs-indentation-ref <- false in + let s-num = arabic (!num-section) ^ `.` ^ arabic (!num-subsection) in + let () = register-cross-reference (label ^ `:num`) s-num in + let () = toc-acc-ref <- (TOCElementSubsection(label, title)) :: !toc-acc-ref in + let ctx-title = make-subsection-title ctx in + let ib-num = + read-inline ctx-title (embed-string (s-num ^ `.`)) + ++ hook-page-break (fun pbinfo _ -> register-cross-reference (label ^ `:page`) (arabic pbinfo#page-number)) + in + let ib-title = read-inline ctx-title title in + let bb-title = + line-break true false (ctx |> set-paragraph-margin section-top-margin section-bottom-margin) + (ib-num ++ (inline-skip 10pt) ++ ib-title ++ (inline-fil)) + in + let bb-inner = read-block ctx inner in + bb-title +++ bb-inner + + + let-block ctx +section ?:labelopt title inner = + let label = + match labelopt with + | None -> generate-fresh-label () + | Some(label) -> label + in + section-scheme ctx label title inner + + + let-block ctx +subsection ?:labelopt title inner = + let label = + match labelopt with + | None -> generate-fresh-label () + | Some(label) -> label + in + subsection-scheme ctx label title inner + + + let-inline ctx \emph inner = + let ctx = + ctx |> set-font Latin font-latin-sans + |> set-cjk-font font-cjk-gothic + in + read-inline ctx inner + + + let-inline \dfn inner = {\emph{#inner;}} + + + let-inline ctx \footnote it = + let size = get-font-size ctx in + let ibf num = + let it-num = embed-string (arabic num) in + let ctx = + ctx |> set-font-size (size *' 0.75) + |> set-manual-rising (size *' 0.25) + in + read-inline ctx {\*#it-num;} + in + let bbf num = + let it-num = embed-string (arabic num) in + let ctx = + ctx |> set-font-size (size *' 0.9) + |> set-leading (size *' 1.2) + |> set-paragraph-margin (size *' 0.5) (size *' 0.5) + %temporary + in + line-break false false ctx (read-inline ctx {#it-num; #it;} ++ inline-fil) + in + FootnoteScheme.main ctx ibf bbf + + end + + +let document = StdJaReport.document + % ad-hoc diff --git a/satysfi.opam b/satysfi.opam index 5c7fe82e8..895695d0a 100644 --- a/satysfi.opam +++ b/satysfi.opam @@ -1,17 +1,51 @@ -opam-version: "1.2" +opam-version: "2.0" name: "satysfi" -version: "0.0.2" +version: "0.0.3" maintainer: "gfngfn" authors: [ "gfngfn" ] homepage: "https://github.com/gfngfn/SATySFi" -dev-repo: "https://github.com/gfngfn/SATySFi.git" +dev-repo: "git+https://github.com/gfngfn/SATySFi.git" bug-reports: "https://github.com/gfngfn/SATySFi/issues" +extra-source "lm2.004otf.zip" { + archive: "http://www.gust.org.pl/projects/e-foundry/latin-modern/download/lm2.004otf.zip" + checksum: [ + "sha256=5b0236051d3728be6616f1b274e3b910473875b5a3ef9382f0ef00384ddb161b" + "sha512=c63068c86590e768498ef5f68a17a737aa40981432d8f6366c29760ea032a603ddd3d748d348ab259beba77966c292f9382b1fe9eb7a78af0926c6abc71f6f81" + ] +} +extra-source "latinmodern-math-1959.zip" { + archive: "http://www.gust.org.pl/projects/e-foundry/lm-math/download/latinmodern-math-1959.zip" + checksum: [ + "sha256=aaaa060b4ffc091461e875efb9498b9abfa7c7a48f38eb33882868839903a4f8" + "sha512=b4fb4b575107b56eee0fed7971b09d334d4b162842675cf5f5ff7cb12e08099fb00755c81ddc1f04138f87b216592299028906165e2cec43521c6ca61b466d4c" + ] +} +extra-source "junicode-1.002.zip" { + archive: "http://downloads.sourceforge.net/project/junicode/junicode/junicode-1.002/junicode-1.002.zip" + checksum: [ + "sha256=c199d96c8424be60fcab8d00d2eee39ea8ae632cfd5e710cbbd70626d6a729e7" + "sha512=1738802f70b0029567be608ed36481864f8f7f029fd1c45d73fa25d092d49c978c51df1c01147b7b176e9b0409d7f15d5713a6daf1b1b269636bc6324b2c6f37" + ] +} +extra-source "IPAexfont00301.zip" { + archive: "https://oscdl.ipa.go.jp/IPAexfont/IPAexfont00301.zip" + checksum: [ + "sha256=c7de095cfded3a549b439b7874cc21b8d73aa16a40d15c31b87bfe0c02f4ae5a" + "sha512=92df9f6a1002ea68cfd88f2b1fe4a5a5d6dfdb0ac4be7f4c0815200ce1962d3db7330ec17e7380efe4ba0735a55e0f5160b0cd6c1553a79fc8a860c434958388" + ] +} build: [ - ["echo" "\"begin to build SATySFi\""] + ["mkdir" "-p" "temp"] + ["unzip" "lm2.004otf.zip" "*.otf" "-d" "lib-satysfi/dist/fonts/"] + ["unzip" "latinmodern-math-1959.zip" "*.otf" "-d" "temp/"] + ["cp" "temp/latinmodern-math-1959/otf/latinmodern-math.otf" "lib-satysfi/dist/fonts/"] + ["unzip" "junicode-1.002.zip" "*.ttf" "-d" "lib-satysfi/dist/fonts/"] + ["unzip" "IPAexfont00301.zip" "*.ttf" "-d" "temp/"] + ["cp" "temp/IPAexfont00301/ipaexg.ttf" "lib-satysfi/dist/fonts/"] + ["cp" "temp/IPAexfont00301/ipaexm.ttf" "lib-satysfi/dist/fonts/"] [make "-f" "Makefile" "PREFIX=%{prefix}%"] - [make "-f" "Makefile" "lib" "PREFIX=%{prefix}%"] ] install: [ [make "-f" "Makefile" "install" "PREFIX=%{prefix}%"] @@ -21,6 +55,7 @@ remove: [ ] # Packages whose version suffix is "+satysfi" are distributed on satysfi-external-repo. depends: [ + "ocaml" {>= "4.06.0"} "batteries" "camlimages" {>= "5.0.1"} "camlpdf" {= "2.2.1+satysfi"} @@ -36,4 +71,3 @@ depends: [ "yojson" "omd" ] -available: [ ocaml-version >= "4.06.0" ] diff --git a/src/frontend/lexer.mll b/src/frontend/lexer.mll index ff67f1aa6..8bff5109e 100644 --- a/src/frontend/lexer.mll +++ b/src/frontend/lexer.mll @@ -29,13 +29,10 @@ | MathState (* math mode *) - let file_name_ref = ref "" - - let get_pos lexbuf = let posS = Lexing.lexeme_start_p lexbuf in let posE = Lexing.lexeme_end_p lexbuf in - let fname = !file_name_ref (* posS.Lexing.pos_fname *) in + let fname = posS.Lexing.pos_fname in let lnum = posS.Lexing.pos_lnum in let cnumS = posS.Lexing.pos_cnum - posS.Lexing.pos_bol in let cnumE = posE.Lexing.pos_cnum - posE.Lexing.pos_bol in @@ -95,13 +92,11 @@ stack - let reset_to_progexpr fname = - file_name_ref := fname; + let reset_to_progexpr () = initialize ProgramState - let reset_to_vertexpr fname = - file_name_ref := fname; + let reset_to_vertexpr () = initialize VerticalState diff --git a/src/frontend/main.ml b/src/frontend/main.ml index e5c60a319..30f52a39f 100644 --- a/src/frontend/main.ml +++ b/src/frontend/main.ml @@ -783,7 +783,7 @@ let error_log_environment suspended = let arg_version () = begin print_string ( - " SATySFi version 0.0.2\n" + " SATySFi version 0.0.3\n" (* ^ " (in the middle of the transition from Macrodown)\n" ^ " ____ ____ ________ _____ ______\n" diff --git a/src/frontend/parserInterface.ml b/src/frontend/parserInterface.ml index 9e3c97764..96ff1310e 100644 --- a/src/frontend/parserInterface.ml +++ b/src/frontend/parserInterface.ml @@ -3,6 +3,8 @@ exception Error of Range.t module I = Parser.MenhirInterpreter +open Lexing + let k_success utast = utast @@ -23,6 +25,7 @@ let k_fail chkpt = let process fname lexbuf = (* print_endline "parserInterface.process"; (* for debug *) *) - let stack = Lexer.reset_to_progexpr fname in + let stack = Lexer.reset_to_progexpr () in + let () = lexbuf.lex_curr_p <- { lexbuf.lex_curr_p with pos_fname = fname } in let supplier = I.lexer_lexbuf_to_supplier (Lexer.cut_token stack) lexbuf in I.loop_handle k_success k_fail supplier (Parser.Incremental.main lexbuf.Lexing.lex_curr_p)