标签: syntax-error

makefile缺少分隔符

好吧,我坚持这个,我不知道我做错了什么.在一个更复杂的makefile上,一切都很好,但突然之间我得到了"Missing separator"错误.我能够将它分离到一个非常简单的场景:

test.mk

define push_dir
$(info ${1})
endef

define pop_dir
$(info ${1})
endef

define include_submake
$(call push_dir,${1})
$(call pop_dir,${1})
endef
Run Code Online (Sandbox Code Playgroud)

简单

include test.mk

INITIAL_SUBMAKE:= includeme.mk
$(call include_submake,${INITIAL_SUBMAKE})

process:
    @echo Processed...
Run Code Online (Sandbox Code Playgroud)

并输出:

C:\project>make -f Simple process
includeme.mk
includeme.mk
Simple:4: *** missing separator.  Stop.
Run Code Online (Sandbox Code Playgroud)

includeme.mk实际上并不存在.我不知道这里出了什么问题我尝试了很多东西.如果我将include_submake的调用包围在这样的信息中:

$(info $(call include_submake,${INITIAL_SUBMAKE}))
Run Code Online (Sandbox Code Playgroud)

丢失的分隔符错误消失了.另外如果在include_submake定义中我只调用其中一个函数,它工作正常.另外,如果我直接调用函数而不是调用它,include_submake它也可以正常工作:

include test.mk

INITIAL_SUBMAKE:= includeme.mk
$(call push_dir,${INITIAL_SUBMAKE})
$(call pop_dir,${INITIAL_SUBMAKE})

process:
    @echo Processed...


C:\project>make -f Simple process
includeme.mk
includeme.mk
Processed...
Run Code Online (Sandbox Code Playgroud)

我觉得我在这里忽略了一些基本的东西.谢谢你的帮助.

makefile syntax-error gnu-make

17
推荐指数
1
解决办法
3万
查看次数

Dict合并在一个词典理解中

在python 3.5中,我们可以通过使用双splat解包来合并dicts

>>> d1 = {1: 'one', 2: 'two'}
>>> d2 = {3: 'three'}
>>> {**d1, **d2}
{1: 'one', 2: 'two', 3: 'three'}
Run Code Online (Sandbox Code Playgroud)

凉.但它似乎没有概括为动态用例:

>>> ds = [d1, d2]
>>> {**d for d in ds}
SyntaxError: dict unpacking cannot be used in dict comprehension
Run Code Online (Sandbox Code Playgroud)

相反,我们必须这样做reduce(lambda x,y: {**x, **y}, ds, {}),这似乎更加丑陋.为什么解析器不允许"一种明显的方法",当表达式中似乎没有任何歧义时?

python dictionary syntax-error python-3.5 dict-comprehension

17
推荐指数
3
解决办法
2789
查看次数

为什么在try块中重新声明函数标识符会抛出SyntaxError?

以下几行JavaScript

try {
    function _free() {}
    var _free = 1;
} finally { }
Run Code Online (Sandbox Code Playgroud)

导致以下错误:

 Uncaught SyntaxError: Identifier '_free' has already been declared
Run Code Online (Sandbox Code Playgroud)

但是,以下两个JavaScript代码块不会:

  1. 没有try块范围:

    function _free() {}
    var _free = 1;
    
    Run Code Online (Sandbox Code Playgroud)
  2. function范围内:

    function a() {
        function _free() {}
        var _free = 1;
    }
    
    Run Code Online (Sandbox Code Playgroud)

但为什么?

(测试环境:Chromium 61.0.3126.0)

javascript syntax-error

17
推荐指数
2
解决办法
912
查看次数

JavaScript:{} == false是一个SyntaxError?

在Firefox 3.5中,我在Firebug控制台中输入:

false=={} // => evals to false
{}==false // syntax error
Run Code Online (Sandbox Code Playgroud)

对此有何解释?

javascript equality syntax-error

16
推荐指数
2
解决办法
905
查看次数

错误C2061:语法错误:标识符

这是我的C++代码

// XuatChuoiBTHang.h
#pragma once
#include "BieuThuc.h"
#include "BieuThucHang.h"

class XuatChuoiBTHang
{
    public:
        virtual string xuatChuoi(BieuThucHang* btHang) = 0;     
};

// BieuThucHang.h
#pragma once
#include "bieuthuc.h"
#include "XuatChuoiBTHang.h"

class BieuThucHang : public BieuThuc
{
    private:
        XuatChuoiBTHang* xuatChuoiBTHang;
};
Run Code Online (Sandbox Code Playgroud)

输出是:

"错误C2061:语法错误:标识符'BieuThucHang'"

怎么解决?

c++ syntax-error

16
推荐指数
1
解决办法
6万
查看次数

传递**kwargs和尾随逗号的SyntaxError

我想知道为什么这是Python 3.4中的SyntaxError:

some_function(
  filename = "foobar.c",
  **kwargs,
)
Run Code Online (Sandbox Code Playgroud)

它在删除之后的尾随逗号时有效**kwargs.

python syntax-error python-3.x python-3.4

16
推荐指数
2
解决办法
896
查看次数

带有async/await的NodeJS脚本导致语法错误(v7.10.0)

我试图在NodeJS中使用async/await,但我的脚本抛出语法错误.

我的印象是,自7.6以来,async/await 得到了天真的支持.当我跑步时,node -v我得到了v7.10.0.

这是以下内容index.js:

async function getValueAsync() {
    return new Promise(function(resolve) {
        resolve('foo');
    });
}

let value = await getValueAsync();
console.log(value);
Run Code Online (Sandbox Code Playgroud)

但是当我调用这个脚本时,node index.js我得到:

let value = await getValueAsync();
                  ^^^^^^^^^^^^^
SyntaxError: Unexpected identifier
    at createScript (vm.js:53:10)
    at Object.runInThisContext (vm.js:95:10)
    at Module._compile (module.js:543:28)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)
    at Module.runMain (module.js:605:10)
    at run (bootstrap_node.js:427:7)
    at startup (bootstrap_node.js:151:9)
Run Code Online (Sandbox Code Playgroud)

我正在运行Linux Mint 18.1.

如何让我的脚本编译和运行?

syntax-error node.js async-await

16
推荐指数
1
解决办法
1万
查看次数

语法'nullishCoalescingOperator'当前未启用

当我试图在ios-simulator上构建我的应用程序时,它说:

捆绑失败:SyntaxError:/Users/MyName/MyApp/node_modules/react-native/node_modules/react-native/Libraries/Components/Switch/Switch.js:nullishCoalescingOperator目前尚未启用对实验语法的支持(167:52):

 165 |         {...props}
  166 |         {...platformProps}
> 167 |         accessibilityRole={props.accessibilityRole ?? 'button'}
      |                                                    ^
  168 |         onChange={this._handleChange}
  169 |         onResponderTerminationRequest={returnsFalse}
  170 |         onStartShouldSetResponder={returnsTrue}
Run Code Online (Sandbox Code Playgroud)

Add @babel/plugin-proposal-nullish-coalescing-operator (https://git.io/vb4Se) to the 'plugins' section of your Babel config to enable transformation.

我做了它说的,但它没有帮助...任何帮助将不胜感激.

syntax-error ios react-native react-native-ios

16
推荐指数
1
解决办法
6144
查看次数

为什么"0f"在C++中不被视为浮点字面值?

为什么0f在C++中不被视为浮点字面值?

#include <iostream>

using namespace std;

int main(){
  cout << 0f << endl;

  return 0;
}
Run Code Online (Sandbox Code Playgroud)

编译上面的内容给了我

C2509(语法错误:'数字上的错误后缀')

使用VS2008.

c++ floating-point syntax syntax-error notation

15
推荐指数
4
解决办法
5375
查看次数

Rails 3.2 Postgres保存错误"ActiveRecord :: StatementInvalid:PG ::错误:错误:位置5'T'附近的语法错误"

当我尝试将特定类保存到数据库时,我的应用程序已经开始抛出错误.我不确定是什么导致这种情况开始发生 - 过去几天我一直有各种各样的数据库问题....

在任何情况下,我的模型似乎工作正常(它正确计算所有before_save值),但然后它尝试保存到数据库并爆炸.

SQL (0.8ms)  INSERT INTO "portfolios" ("correlation_matrix", "created_at", "data", "mean_return", "std_dev", "updated_at", "weights") VALUES ($1, $2, $3, $4, $5, $6, $7) RETURNING "id"  [["correlation_matrix", "--- \n- - 1.0\n  - -0.4873114574375062\n- - -0.4873114574375062\n  - 1.0\n"], ["created_at", Sat, 16 Jun 2012 15:12:35 MDT -06:00], ["data", {"TSX"=>0.5, "VUSTX"=>0.5}], ["mean_return", #<BigDecimal:7fadb119b750,'0.488052381E-1',18(45)>], ["std_dev", #<BigDecimal:7fadb119b598,'0.7668705159 123244E-1',18(45)>], ["updated_at", Sat, 16 Jun 2012 15:12:35 MDT -06:00], ["weights", "--- \nTSX: 0.5\nVUSTX: 0.5\n"]]
Run Code Online (Sandbox Code Playgroud)

抛出此错误:

ActiveRecord::StatementInvalid: PG::Error: ERROR:  Syntax error near 'T' at position 5
Run Code Online (Sandbox Code Playgroud)

我不知道这个错误意味着什么(或者这个'T'是什么......),甚至在哪里开始排除故障......任何帮助都将不胜感激.

我可以发布任何可能需要的信息来解决这个问题....

相关迁移: …

ruby postgresql ruby-on-rails syntax-error

15
推荐指数
1
解决办法
6572
查看次数