Why doesn't this multi-line macro (with \r\n line endings) work with INCISIV? - macros

When using the following SystemVerilog macro with INCISIV 13.10 (from http://www.edaplayground.com/x/2YG ) (line endings are \r\n)
`define CHECK_PORT_CONNECTION(PORT) \
begin \
uvm_port_list list; \
PORT.get_provided_to(list); \
if (!list.size()) begin \
`uvm_fatal("AP_CONNECT", \
$sformatf("Analysis port %s not connected.", PORT.get_full_name())); \
end \
end
I get a bunch of errors (below). The only way I can get it to work is to get rid of all the \ and put the macro on 1 line. Why isn't this multi-line macro working with INCISIV? I tried it with 3 other simulators and it worked fine.
Invocation and errors:
[2014-11-17 13:53:06 EST] /bin/bash -c irun -access +rw -Q -unbuffered -uvmhome $UVM_HOME $UVM_HOME/src/uvm_macros.svh design.sv testbench.sv
irun: 13.10-p001: (c) Copyright 1995-2013 Cadence Design Systems, Inc.
begin \
|
ncvlog: *E,NULLEI (my_defines.sv,3|9): zero length escaped identifier [2.7.1(IEEE)].
(`include file: my_defines.sv line 3, file: testbench.sv line 7)
begin \
|
ncvlog: *E,NOIPRT (my_defines.sv,3|9): Unrecognized declaration '\ ' could be an unsupported keyword, a spelling mistake or missing instance port list '()' [SystemVerilog].
(`include file: my_defines.sv line 4, file: testbench.sv line 7)
begin \
|
ncvlog: *E,NCUITEM (my_defines.sv,3|9): Not a valid compilation unit/global item: 'interface_declaration' [SystemVerilog].
(`include file: my_defines.sv line 4, file: testbench.sv line 7)
begin \
|
ncvlog: *E,NGITEM (my_defines.sv,3|9): Not a valid generate item: 'interface_declaration' [12.1.3(IEEE 2001)].
(`include file: my_defines.sv line 4, file: testbench.sv line 7)
uvm_port_list list; \
|
ncvlog: *E,EXPSMC (my_defines.sv,4|21): expecting a semicolon (';') [SystemVerilog].
(`include file: my_defines.sv line 4, file: testbench.sv line 7)
uvm_port_list list; \
|
ncvlog: *E,NULLEI (my_defines.sv,4|25): zero length escaped identifier [2.7.1(IEEE)].
(`include file: my_defines.sv line 4, file: testbench.sv line 7)
uvm_port_list list; \
|
ncvlog: *E,NOIPRT (my_defines.sv,4|25): Unrecognized declaration '\ ' could be an unsupported keyword, a spelling mistake or missing instance port list '()' [SystemVerilog].
(`include file: my_defines.sv line 5, file: testbench.sv line 7)
uvm_port_list list; \
|
ncvlog: *E,NCUITEM (my_defines.sv,4|25): Not a valid compilation unit/global item: 'interface_declaration' [SystemVerilog].
(`include file: my_defines.sv line 5, file: testbench.sv line 7)
uvm_port_list list; \
|
ncvlog: *E,NGITEM (my_defines.sv,4|25): Not a valid generate item: 'interface_declaration' [12.1.3(IEEE 2001)].
(`include file: my_defines.sv line 5, file: testbench.sv line 7)
PORT.get_provided_to(list); \
|
ncvlog: *E,ILLHIN (my_defines.sv,5|8): illegal location for a hierarchical name (PORT).
(`include file: my_defines.sv line 5, file: testbench.sv line 7)
PORT.get_provided_to(list); \
|
ncvlog: *E,EXPSMC (my_defines.sv,5|24): expecting a semicolon (';') [12.3.2(IEEE)].
(`include file: my_defines.sv line 5, file: testbench.sv line 7)
PORT.get_provided_to(list); \
|
ncvlog: *E,EXPSMC (my_defines.sv,5|29): expecting a semicolon (';') [12.3.2(IEEE)].
(`include file: my_defines.sv line 5, file: testbench.sv line 7)
PORT.get_provided_to(list); \
|
ncvlog: *E,NULLEI (my_defines.sv,5|33): zero length escaped identifier [2.7.1(IEEE)].
(`include file: my_defines.sv line 5, file: testbench.sv line 7)
if (!list.size()) begin \
|
ncvlog: *E,NCUITEM (my_defines.sv,6|5): Not a valid compilation unit/global item: 'module/udp instance' [SystemVerilog].
(`include file: my_defines.sv line 6, file: testbench.sv line 7)
if (!list.size()) begin \
|
ncvlog: *E,EXPLPA (my_defines.sv,6|5): expecting a left parenthesis ('(') [12.1.2][7.1(IEEE)].
(`include file: my_defines.sv line 6, file: testbench.sv line 7)
if (!list.size()) begin \
|
ncvlog: *E,EXPSMC (my_defines.sv,6|26): expecting a semicolon (';') [12.1.2][7.1(IEEE)].
(`include file: my_defines.sv line 6, file: testbench.sv line 7)
if (!list.size()) begin \
|
ncvlog: *E,NULLEI (my_defines.sv,6|29): zero length escaped identifier [2.7.1(IEEE)].
(`include file: my_defines.sv line 6, file: testbench.sv line 7)
$sformatf("Analysis port %s not connected.", PORT.get_full_name())); \
|
ncvlog: *E,EXPLPA (my_defines.sv,8|74): expecting a left parenthesis ('(') [12.1.2][7.1(IEEE)].
(`define macro: uvm_fatal [/home/vlyubosl/playground_lib/uvm-1.1d/src/macros/uvm_message_defines.svh line 156], `include file: my_defines.sv line 8, file: testbench.sv line 7)
$sformatf("Analysis port %s not connected.", PORT.get_full_name())); \
|
ncvlog: *E,EXPSMC (my_defines.sv,8|74): expecting a semicolon (';') [12.1.2][7.1(IEEE)].
(`define macro: uvm_fatal [/home/vlyubosl/playground_lib/uvm-1.1d/src/macros/uvm_message_defines.svh line 156], `include file: my_defines.sv line 8, file: testbench.sv line 7)
$sformatf("Analysis port %s not connected.", PORT.get_full_name())); \
|
ncvlog: *E,NULLEI (my_defines.sv,8|74): zero length escaped identifier [2.7.1(IEEE)].
(`define macro: uvm_fatal [/home/vlyubosl/playground_lib/uvm-1.1d/src/macros/uvm_message_defines.svh line 156], `include file: my_defines.sv line 8, file: testbench.sv line 7)
$sformatf("Analysis port %s not connected.", PORT.get_full_name())); \
|
ncvlog: *E,EXPRPA (my_defines.sv,8|74): expecting a right parenthesis (')') [12.1.2][7.1(IEEE)].
(`define macro: uvm_fatal [/home/vlyubosl/playground_lib/uvm-1.1d/src/macros/uvm_message_defines.svh line 156], `include file: my_defines.sv line 8, file: testbench.sv line 7)
$sformatf("Analysis port %s not connected.", PORT.get_full_name())); \
|
ncvlog: *E,EXPLPA (my_defines.sv,8|74): expecting a left parenthesis ('(') [12.1.2][7.1(IEEE)].
(`define macro: uvm_fatal [/home/vlyubosl/playground_lib/uvm-1.1d/src/macros/uvm_message_defines.svh line 156], `include file: my_defines.sv line 8, file: testbench.sv line 7)
$sformatf("Analysis port %s not connected.", PORT.get_full_name())); \
|
ncvlog: *E,EXPLPA (my_defines.sv,8|74): expecting a left parenthesis ('(') [12.1.2][7.1(IEEE)].
(`define macro: "my_defines.sv", `define macro: uvm_file [/home/vlyubosl/playground_lib/uvm-1.1d/src/macros/uvm_message_defines.svh line 45], `define macro: uvm_fatal [/home/vlyubosl/playground_lib/uvm-1.1d/src/macros/uvm_message_defines.svh line 156], `include file: my_defines.sv line 8, file: testbench.sv line 7)
$sformatf("Analysis port %s not connected.", PORT.get_full_name())); \
|
ncvlog: *E,EXPLPA (my_defines.sv,8|74): expecting a left parenthesis ('(') [12.1.2][7.1(IEEE)].
(`define macro: uvm_line [/home/vlyubosl/playground_lib/uvm-1.1d/src/macros/uvm_message_defines.svh line 51], `define macro: uvm_fatal [/home/vlyubosl/playground_lib/uvm-1.1d/src/macros/uvm_message_defines.svh line 156], `include file: my_defines.sv line 8, file: testbench.sv line 7)
$sformatf("Analysis port %s not connected.", PORT.get_full_name())); \
|
ncvlog: *W,UEXPSC (my_defines.sv,8|75): Ignored unexpected semicolon following SystemVerilog description keyword (end).
(`include file: my_defines.sv line 8, file: testbench.sv line 7)
$sformatf("Analysis port %s not connected.", PORT.get_full_name())); \
|
ncvlog: *E,NULLEI (my_defines.sv,8|78): zero length escaped identifier [2.7.1(IEEE)].
(`include file: my_defines.sv line 8, file: testbench.sv line 7)
end \
|
ncvlog: *E,NCUITEM (my_defines.sv,9|6): Not a valid compilation unit/global item: 'module/udp instance' [SystemVerilog].
(`include file: my_defines.sv line 9, file: testbench.sv line 7)
end \
|
ncvlog: *E,EXPLPA (my_defines.sv,9|6): expecting a left parenthesis ('(') [12.1.2][7.1(IEEE)].
(`include file: my_defines.sv line 9, file: testbench.sv line 7)
end \
|
ncvlog: *E,NULLEI (my_defines.sv,9|9): zero length escaped identifier [2.7.1(IEEE)].
(`include file: my_defines.sv line 9, file: testbench.sv line 7)
end
|
ncvlog: *E,EXPLPA (my_defines.sv,10|4): expecting a left parenthesis ('(') [12.1.2][7.1(IEEE)].
(`include file: my_defines.sv line 10, file: testbench.sv line 7)
`uvm_analysis_imp_decl(_good_xp)
|
ncvlog: *E,SVNOTY (testbench.sv,10|31): Syntactically this identifier appears to begin a datatype but it does not refer to a visible datatype in the current scope.
(`define macro: uvm_analysis_imp_decl [/home/vlyubosl/playground_lib/uvm-1.1d/src/macros/uvm_tlm_defines.svh line 491], file: testbench.sv line 10)
`uvm_analysis_imp_decl(_good_xp)
|
ncvlog: *E,CLSSPX (testbench.sv,10|31): 'super' can only be used within a class scope that derives from a base class.
(`define macro: UVM_IMP_COMMON [/home/vlyubosl/playground_lib/uvm-1.1d/src/tlm1/uvm_tlm_imps.svh line 205], `define macro: uvm_analysis_imp_decl [/home/vlyubosl/playground_lib/uvm-1.1d/src/macros/uvm_tlm_defines.svh line 491], file: testbench.sv line 10)
`uvm_analysis_imp_decl(_bad_xp)
|
ncvlog: *E,SVNOTY (testbench.sv,11|30): Syntactically this identifier appears to begin a datatype but it does not refer to a visible datatype in the current scope.
(`define macro: uvm_analysis_imp_decl [/home/vlyubosl/playground_lib/uvm-1.1d/src/macros/uvm_tlm_defines.svh line 491], file: testbench.sv line 11)
`uvm_analysis_imp_decl(_bad_xp)
|
ncvlog: *E,CLSSPX (testbench.sv,11|30): 'super' can only be used within a class scope that derives from a base class.
(`define macro: UVM_IMP_COMMON [/home/vlyubosl/playground_lib/uvm-1.1d/src/tlm1/uvm_tlm_imps.svh line 205], `define macro: uvm_analysis_imp_decl [/home/vlyubosl/playground_lib/uvm-1.1d/src/macros/uvm_tlm_defines.svh line 491], file: testbench.sv line 11)
class my_scoreboard extends uvm_scoreboard;
|
ncvlog: *E,SVNOTY (testbench.sv,14|41): Syntactically this identifier appears to begin a datatype but it does not refer to a visible datatype in the current scope.
uvm_analysis_imp_good_xp#(int, my_scoreboard) good_xp;
|
ncvlog: *E,EXPENC (testbench.sv,17|25): Expecting the keyword 'endclass'.
function void end_of_elaboration_phase(uvm_phase phase);
|
ncvlog: *E,SVNOTY (testbench.sv,23|49): Syntactically this identifier appears to begin a datatype but it does not refer to a visible datatype in the current scope.
`uvm_component_utils(my_scoreboard)
|
ncvlog: *E,SVNOTY (testbench.sv,30|36): Syntactically this identifier appears to begin a datatype but it does not refer to a visible datatype in the current scope.
(`define macro: m_uvm_component_registry_internal [/home/vlyubosl/playground_lib/uvm-1.1d/src/macros/uvm_object_defines.svh line 467], `define macro: uvm_component_utils [/home/vlyubosl/playground_lib/uvm-1.1d/src/macros/uvm_object_defines.svh line 330], file: testbench.sv line 30)
`uvm_component_utils(my_scoreboard)
|
ncvlog: *E,SVEXTK (testbench.sv,30|36): expecting a ';' (to terminate a type_declaration).
(`define macro: m_uvm_component_registry_internal [/home/vlyubosl/playground_lib/uvm-1.1d/src/macros/uvm_object_defines.svh line 467], `define macro: uvm_component_utils [/home/vlyubosl/playground_lib/uvm-1.1d/src/macros/uvm_object_defines.svh line 330], file: testbench.sv line 30)
`uvm_component_utils(my_scoreboard)
|
ncvlog: *E,SVEXTK (testbench.sv,30|36): expecting a ';' (to terminate a type_declaration).
(`define macro: m_uvm_component_registry_internal [/home/vlyubosl/playground_lib/uvm-1.1d/src/macros/uvm_object_defines.svh line 467], `define macro: uvm_component_utils [/home/vlyubosl/playground_lib/uvm-1.1d/src/macros/uvm_object_defines.svh line 330], file: testbench.sv line 30)
`uvm_component_utils(my_scoreboard)
|
ncvlog: *E,BADQAL (testbench.sv,30|36): Lifetime or qualifier(s) 'static' not allowed before function declaration.
(`define macro: m_uvm_component_registry_internal [/home/vlyubosl/playground_lib/uvm-1.1d/src/macros/uvm_object_defines.svh line 467], `define macro: uvm_component_utils [/home/vlyubosl/playground_lib/uvm-1.1d/src/macros/uvm_object_defines.svh line 330], file: testbench.sv line 30)
`uvm_component_utils(my_scoreboard)
|
ncvlog: *E,SVNOTY (testbench.sv,30|36): Syntactically this identifier appears to begin a datatype but it does not refer to a visible datatype in the current scope.
(`define macro: m_uvm_component_registry_internal [/home/vlyubosl/playground_lib/uvm-1.1d/src/macros/uvm_object_defines.svh line 467], `define macro: uvm_component_utils [/home/vlyubosl/playground_lib/uvm-1.1d/src/macros/uvm_object_defines.svh line 330], file: testbench.sv line 30)
`uvm_component_utils(my_scoreboard)
|
ncvlog: *E,EXPSMC (testbench.sv,30|36): expecting a semicolon (';') [10.3.1(IEEE)].
(`define macro: m_uvm_component_registry_internal [/home/vlyubosl/playground_lib/uvm-1.1d/src/macros/uvm_object_defines.svh line 467], `define macro: uvm_component_utils [/home/vlyubosl/playground_lib/uvm-1.1d/src/macros/uvm_object_defines.svh line 330], file: testbench.sv line 30)
`uvm_component_utils(my_scoreboard)
|
ncvlog: *E,BADQAL (testbench.sv,30|36): Lifetime or qualifier(s) 'virtual' not allowed before function declaration.
(`define macro: m_uvm_component_registry_internal [/home/vlyubosl/playground_lib/uvm-1.1d/src/macros/uvm_object_defines.svh line 467], `define macro: uvm_component_utils [/home/vlyubosl/playground_lib/uvm-1.1d/src/macros/uvm_object_defines.svh line 330], file: testbench.sv line 30)
`uvm_component_utils(my_scoreboard)
|
ncvlog: *E,SVNOTY (testbench.sv,30|36): Syntactically this identifier appears to begin a datatype but it does not refer to a visible datatype in the current scope.
(`define macro: m_uvm_component_registry_internal [/home/vlyubosl/playground_lib/uvm-1.1d/src/macros/uvm_object_defines.svh line 467], `define macro: uvm_component_utils [/home/vlyubosl/playground_lib/uvm-1.1d/src/macros/uvm_object_defines.svh line 330], file: testbench.sv line 30)
`uvm_component_utils(my_scoreboard)
|
ncvlog: *E,EXPSMC (testbench.sv,30|36): expecting a semicolon (';') [10.3.1(IEEE)].
(`define macro: m_uvm_component_registry_internal [/home/vlyubosl/playground_lib/uvm-1.1d/src/macros/uvm_object_defines.svh line 467], `define macro: uvm_component_utils [/home/vlyubosl/playground_lib/uvm-1.1d/src/macros/uvm_object_defines.svh line 330], file: testbench.sv line 30)
`uvm_component_utils(my_scoreboard)
|
ncvlog: *E,BADQAL (testbench.sv,30|36): Lifetime or qualifier(s) 'virtual' not allowed before function declaration.
(`define macro: m_uvm_get_type_name_func [/home/vlyubosl/playground_lib/uvm-1.1d/src/macros/uvm_object_defines.svh line 427], `define macro: uvm_component_utils [/home/vlyubosl/playground_lib/uvm-1.1d/src/macros/uvm_object_defines.svh line 330], file: testbench.sv line 30)
function new (string name, uvm_component parent);
|
ncvlog: *E,NEWOIC (testbench.sv,32|13): The class constructor method 'new' is only allowed within a class declaration.
function new (string name, uvm_component parent);
|
ncvlog: *E,EXPRPA (testbench.sv,32|41): expecting a right parenthesis (')') [A.2.6(IEEE)].
function new (string name, uvm_component parent);
|
ncvlog: *E,NOIPRT (testbench.sv,32|41): Unrecognized declaration 'uvm_component' could be an unsupported keyword, a spelling mistake or missing instance port list '()' [SystemVerilog].
function new (string name, uvm_component parent);
|
ncvlog: *E,NOTINF (testbench.sv,32|41): Interfaces are not allowed within tasks [SystemVerilog].
function new (string name, uvm_component parent);
|
ncvlog: *E,ILLPDL (testbench.sv,32|48): Mixing of ansi & non-ansi style port declaration is not legal.
function new (string name, uvm_component parent);
|
ncvlog: *E,EXPSMC (testbench.sv,32|49): expecting a semicolon (';') [12.3.2(IEEE)].
super.new(name, parent);
|
ncvlog: *E,EXPRPA (testbench.sv,33|8): expecting a right parenthesis (')') [A.2.6(IEEE)].
super.new(name, parent);
|
ncvlog: *E,CLSSPX (testbench.sv,33|8): 'super' can only be used within a class scope that derives from a base class.
endclass
|
ncvlog: *E,MPANDC (testbench.sv,41|7): expecting the keyword 'module', 'macromodule', 'primitive', 'connectmodule','connect', 'discipline' or 'nature' [A.1].
irun: *E,VLGERR: An error occurred during parsing. Review the log file for errors with the code *E and fix those identified problems to proceed. Exiting with code (status 1).

The problem should be there is a white-space after the \ in the line before begin.
Notices it says "Unrecognized declaration '\ '", not "Unrecognized declaration '\'"
With the provided code on EDA-playground, I could not reproduce error. I believe that auto-format is deleting the trailing white-spaces. When I manually insert a space after the \ the errors match my exactly; and other simulators give equivalent errors.

Related

how to to create a mulitline macro in julia?

macro Estruct(name,arg,type,max=100,min=0,descritpion="")
:(struct $(esc(name))
$((esc(arg)))
$(esc(name))($(esc(arg)))=new(
check($(esc(type)),$(esc(arg)),$(esc(name)),$(esc(max)),$(esc(min)),$(esc(descritpion))))
end)
end
how can I imeplent this macro like this:
#Estruct begin
B
arg1
Float64
200.0
5.0
"this"
end
I don't know how to make a multiline macro. I thought I just have to add begin and end, but I'm always getting: MethodError: no method matching var"#Estruct"(::LineNumberNode, ::Module, ::Expr)
There's no such thing as a multiline macro, that's just a macro that takes a block as an argument. You can see how the macro gets invoked by writing a dummy version of it that just returns its arguments:
macro Estruct(args...); args; end
Now you can invoke that the way you want to call it and it will return its arguments as a tuple:
julia> args = #Estruct begin
B
arg1
Float64
200.0
5.0
"this"
end
(quote
#= REPL[12]:2 =#
B
#= REPL[12]:3 =#
arg1
#= REPL[12]:4 =#
Float64
#= REPL[12]:5 =#
200.0
#= REPL[12]:6 =#
5.0
#= REPL[12]:7 =#
"this"
end,)
julia> typeof(args)
Tuple{Expr}
julia> dump(args[1])
Expr
head: Symbol block
args: Array{Any}((12,))
1: LineNumberNode
line: Int64 2
file: Symbol REPL[12]
2: Symbol B
3: LineNumberNode
line: Int64 3
file: Symbol REPL[12]
4: Symbol arg1
5: LineNumberNode
line: Int64 4
file: Symbol REPL[12]
...
8: Float64 200.0
9: LineNumberNode
line: Int64 6
file: Symbol REPL[12]
10: Float64 5.0
11: LineNumberNode
line: Int64 7
file: Symbol REPL[12]
12: String "this"
julia> args[1].args
12-element Vector{Any}:
:(#= REPL[12]:2 =#)
:B
:(#= REPL[12]:3 =#)
:arg1
:(#= REPL[12]:4 =#)
:Float64
:(#= REPL[12]:5 =#)
200.0
:(#= REPL[12]:6 =#)
5.0
:(#= REPL[12]:7 =#)
"this"
This tells you that the macro gets called with a single argument which is an Expr with head type :block, i.e. the one argument is a quoted block. To implement your "multiline macro" you need to implement the macro body to accept a quoted block expression and process it, presumably by looking at its .args field which is where all the expressions you're interested in are. You'll probably want to ignore all the LineNumberNode objects in there and just process the other items in the block.

Illegal Character Escape in Text.Smolder.Renderer.String.purs

In an attempt to compile my program, I received the following error regarding the file String.purs from the Text.Smolder.Renderer module:
Error found:
at bower_components\purescript-smolder\src\Text\Smolder\Renderer\String.purs:76:
56 - 76:57 (line 76, column 56 - line 76, column 57)
Unable to parse module:
Illegal character escape code
I looked at the source file and found the following at line 76:
toStream s = foldr (\c t -> c :< (Just t)) (mkCofree '\0' Nothing) cs
How can this be corrected? (And how on earth could a compiler error be in a public library!!!)

ValueError: a string literal cannot contain nul (0x00) characters odoo

I'm getting this error when I try to import users
NB:
the module works fine: I can import users using odoo 10 and postgres 9.3 ubuntu 14
but here I'm using postgres 9.5 odoo 10 ubuntu 16
File "/home/belazar/Documents/addons_odoo10/hr_biometric_machine/models/biometric_machine.py", line 113, in create_user
'biometric_device': self.id, }
File "/opt/odoo/odoo/models.py", line 3830, in create
record = self.browse(self._create(old_vals))
File "/opt/odoo/odoo/models.py", line 3925, in _create
cr.execute(query, tuple(u[2] for u in updates if len(u) > 2))
File "/opt/odoo/odoo/sql_db.py", line 154, in wrapper
return f(self, *args, **kwargs)
File "/opt/odoo/odoo/sql_db.py", line 231, in execute
res = self._obj.execute(query, params)
ValueError: A string literal cannot contain NUL (0x00) characters.
the problem is solved by on /opt/odoo/odoo/sql_db.py commenting those lines:
#from tools import parse_version as pv
#if pv(psycopg2.__version__) < pv('2.7'):
# from psycopg2._psycopg import QuotedString
# def adapt_string(adapted):
# """Python implementation of psycopg/psycopg2#459 from v2.7"""
# if '\x00' in adapted:
# raise ValueError("A string literal cannot contain NUL (0x00) characters.")
# return QuotedString(adapted)
#psycopg2.extensions.register_adapter(str, adapt_string)
#psycopg2.extensions.register_adapter(unicode, adapt_string)

Error: illegal character '#'

I tried running the logic file from Doop test set in Logic Blox 3.10. I run the analysis.js file in 1-call-site-sensitive folder
using following commands in sequence:
lb create testworkspace
lb exec testworkspace --file analysis.logic
It prompts me the following errors:
ubuntu#ubuntu:~/doop/logic/1-call-site-sensitive$ lb exec testworkspace --file analysis.logic
Error: block __block0: line 8: error: illegal character '#' (code: ILLEGAL_CHARACTER)
#include "macros.logic"
^
block __block0: line 8: error: unexpected token 'macros.logic' (code: UNEXPECTED_TOKEN)
#include "macros.logic"
^
block __block0: line 9: error: illegal character '#' (code: ILLEGAL_CHARACTER)
#include "../context-sensitive.logic"
^
block __block0: line 10: error: illegal character '#' (code: ILLEGAL_CHARACTER)
#include "../library.logic"
^
block __block0: line 47: error: illegal character '#' (code: ILLEGAL_CHARACTER)
#ifdef PADDLE_COMPAT
^
block __block0: line 47: error: unexpected token 'PADDLE_COMPAT' (code: UNEXPECTED_TOKEN)
#ifdef PADDLE_COMPAT
^^^^^^^^^^^^^
block __block0: line 48: error: unexpected token '.' (code: UNEXPECTED_TOKEN)
MethodInvocationValue(?startupInvocation, "<<no-context>>").
^
block __block0: line 49: error: illegal character '#' (code: ILLEGAL_CHARACTER)
#else
^
block __block0: line 51: error: illegal character '#' (code: ILLEGAL_CHARACTER)
#endif
^
block __block0: line 62: error: illegal character '#' (code: ILLEGAL_CHARACTER)
#ifdef PADDLE_COMPAT
^
block __block0: line 64: error: illegal character '#' (code: ILLEGAL_CHARACTER)
#else
^
block __block0: line 66: error: illegal character '#' (code: ILLEGAL_CHARACTER)
#endif
^
block __block0: line 73: error: illegal character '#' (code: ILLEGAL_CHARACTER)
#ifdef PADDLE_COMPAT
^
block __block0: line 75: error: illegal character '#' (code: ILLEGAL_CHARACTER)
#else
^
block __block0: line 77: error: illegal character '#' (code: ILLEGAL_CHARACTER)
#endif
^
block __block0: line 85: error: illegal character '#' (code: ILLEGAL_CHARACTER)
#ifdef PADDLE_COMPAT
^
block __block0: line 87: error: illegal character '#' (code: ILLEGAL_CHARACTER)
#else
^
block __block0: line 89: error: illegal character '#' (code: ILLEGAL_CHARACTER)
#endif
^
18 ERRORS (BloxCompiler version 73677_d4ce8757cf9e9f444fdfe6fd6e4f43064577d1e8)
Am I running it correctly? I have attached all the files I have run with LogicBlox in this link:
Doop currently supports only version 3.X (preferably 3.9 or 3.10) of the LogicBlox engine. Furthermore, doop is a whole framework. It's not just a logic file. In order to run doop, you have to invoke the wrapping script or gradlew directly.
I suggest you check this tutorial from PLDI'15. http://plast-lab.github.io/doop-pldi15-tutorial/

How to print all lines except the line before a pattern in file using awk

How can we do this with awk?
Input file
Line 1
Line 2
####PATTERN####### (Line 3)
Line 4
Line 5
Line 6
####PATTERN####### (line 7)
Line 8
####PATTERN####### (Line 9)
etc..
output file
Line 1
Line 3
Line 4
Line 5
Line 7
Line 9
sed '$!N;s/.*####PATTERN####### \(.*\)/\1/;P;D' text
Output
Line 1
(Line 3)
Line 4
Line 5
(line 7)
(Line 9)
The N command grabs the next line from the input into the pattern space so that we can perform a pattern matching against two lines. If we discover ####PATTERN###### in the middle, we only keep the second part so that the previous line is deleted. The P command prints the resulted pattern.
Code for sed:
sed -nr '/####PATTERN#######/!{x;1!p;x};$p;h' file
$ sed -nr '/####PATTERN#######/!{x;1!p;x};$p;h' file
Line 1
####PATTERN####### (Line 3)
Line 4
Line 5
####PATTERN####### (line 7)
####PATTERN####### (Line 9)
Code for GNU awk:
awk '{if ($0 ~ /PATTERN/ && NR>1) {delete l[(NR-1)]}; l[NR]=$0}END {for (a in l) print l[a]}' file
$ awk '{if ($0 ~ /PATTERN/ && NR>1) {delete l[(NR-1)]}; l[NR]=$0}END {for (a in l) print l[a]}' file
Line 1
####PATTERN####### (Line 3)
Line 4
Line 5
####PATTERN####### (line 7)
####PATTERN####### (Line 9)
Here is one way with awk:
awk '/PATTERN/{for(;i<NR-2;)print lines[++i];i=NR;delete lines;print $0}{lines[NR]=$0}' file
Output:
$ cat file
Line 1
Line 2
####PATTERN####### (Line 3)
Line 4
Line 5
Line 6
####PATTERN####### (line 7)
Line 8
####PATTERN####### (Line 9)
$ awk '/PATTERN/{for(;i<NR-2;)print lines[++i];i=NR;delete lines;print $0}{lines[NR]=$0}' file
Line 1
####PATTERN####### (Line 3)
Line 4
Line 5
####PATTERN####### (line 7)
####PATTERN####### (Line 9)