From 22acb046edff8272c550ed6d1947e8c1b431b4ec Mon Sep 17 00:00:00 2001 From: Rick Carlino Date: Mon, 11 May 2020 07:44:26 -0500 Subject: [PATCH] 10 failures --- README.md | 1 + lib/pigeon.rb | 6 +++--- lib/pigeon/lexer.rb | 2 +- spec/pigeon/lexer_spec.rb | 14 +++++++------- 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 12a4e96..9191f4a 100644 --- a/README.md +++ b/README.md @@ -51,6 +51,7 @@ See `kitchen_sink.sh` examples. - [X] Update Ruby API docs - [X] Update blobs spec to clear out blob folder every time it runs. - [ ] Oops, `lipmaa` field needs to be a hash, not an integer! + - [ ] Change `@`, `%`, `&` to `feed.`, `mesg.`, `blob.`, respectively. Better readability, easier onboarding, URL friendly. - [ ] Change draft and message templates to render headers in this order: `author`, `prev`, `lipmaa`, `depth`, `kind`. - [ ] Make location of blob folder configurable? - [ ] Update Dev docs in protocol spec to reflect changes to `lipmaa` header. diff --git a/lib/pigeon.rb b/lib/pigeon.rb index d9dbef7..f38347f 100644 --- a/lib/pigeon.rb +++ b/lib/pigeon.rb @@ -170,9 +170,9 @@ module Pigeon draft.author = author draft.depth = depth draft.prev = db.get_message_by_depth(mhash, depth - 1) - lipmaa = Helpers.lipmaa(depth) - if lipmaa && draft.prev - draft.lipmaa = db.get_message_by_depth(mhash, lipmaa) + lpma = Helpers.lipmaa(depth) + if lpma && draft.prev + draft.lipmaa = db.get_message_by_depth(mhash, lpma) else draft.lipmaa = NOTHING end diff --git a/lib/pigeon/lexer.rb b/lib/pigeon/lexer.rb index b9b969e..d8001b9 100644 --- a/lib/pigeon/lexer.rb +++ b/lib/pigeon/lexer.rb @@ -76,7 +76,7 @@ module Pigeon class LexError < StandardError; end def flunk!(where) - msg = "Syntax error: #{scanner.pos} under #{@last_good} field in #{where}" + msg = "Syntax error pos #{scanner.pos} by #{@last_good} field in #{where}" raise LexError, msg end diff --git a/spec/pigeon/lexer_spec.rb b/spec/pigeon/lexer_spec.rb index 2b29ade..066c460 100644 --- a/spec/pigeon/lexer_spec.rb +++ b/spec/pigeon/lexer_spec.rb @@ -161,13 +161,13 @@ RSpec.describe Pigeon::Lexer do it "catches syntax errors" do e = Pigeon::Lexer::LexError err_map = { - 0 => "Syntax error at 0. Failed to read header field.", - 1 => "Syntax error at 69. Failed to read header field.", - 2 => "Syntax error at 84. Failed to read header field.", - 3 => "Syntax error at 94. Failed to read header field.", - 4 => "Syntax error at 102. Failed to read header field.", - 5 => "Syntax error at 103. Failed to read body field.", - 6 => "Syntax error at 113. Failed to read body field.", + 0 => "Syntax error pos 0 by START field in HEADER", + 1 => "Syntax error pos 69 by AUTHOR field in HEADER", + 2 => "Syntax error pos 84 by KIND field in HEADER", + 3 => "Syntax error pos 94 by PREV field in HEADER", + 4 => "Syntax error pos 102 by DEPTH field in HEADER", + 5 => "Syntax error pos 103 by HEADER_SEPERATOR field in BODY", + 6 => "Syntax error pos 113 by A_BODY_ENTRY field in BODY", 7 => "Parse error at 114. Double carriage return not found.", } (0..7).to_a.map do |n|