basic-bytestring wrapper does not work with left contexts

オープン
#53 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

  • #165 @誰か による — マージされずにクローズ

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
35/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
haskell
領域
compilers

調査の方向性

まず issue の再現手順を実行し、リンクされた行の周辺にある templates/wrappers.hs の alexGetByte を調べます。basic-bytestring がマルチバイト UTF-8 入力の左コンテキストをどのように扱うかを追跡します。∃^∀ 規則が期待どおりに動作するか、または wrapper の左コンテキストに関する制限が明示的に解消され、カバーされていれば完了です。

索引モデルが issue の本文から書いたものです。

説明

The basic-bytestring wrapper does not work correctly with left contexts when provided with characters which are encoded as multiple bytes in UTF-8.

The following program produces True,False while I expect it to produce True,True.

{
{-# LANGUAGE OverloadedStrings #-}
module Main where
import qualified Data.ByteString.Lazy.Char8 as B
}

%wrapper "basic-bytestring"

tokens :-
  a^b    {const True}
  a      {const True}
  ∃^∀    {const True}
  ∃      {const True}
  .      {const False}

{
main::IO ()
main = do
  print . and . alexScanTokens $ "ab"
  print . and . alexScanTokens $ "∃∀"
}

I think this is due to alexGetByte for this wrapper remembering the last byte rather than the last character.

Since converting input bytes to characters puts unnecessary costs on the users of this wrapper maybe we should just not implement left contexts in this case?

主要言語
Haskell
スター
323
フォーク
87
PR マージ指標
30日以内にマージされた PR はありません

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

haskell/alex のほかの issue

haskell/alex の issue をすべて見る

似ている issue

Haskell の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。