标签: parse-error

在Haskell中解析错误

以下代码:

import IO
import System(getArgs)

main = do
    args <- getArgs
    let l = length args
    if l == 0
        putStrLn "foo"
    else
        putStrLn "bar"
Run Code Online (Sandbox Code Playgroud)

为if-else子句生成解析错误.我尝试使用花括号无济于事.救命!

haskell parse-error

0
推荐指数
1
解决办法
2065
查看次数

解析错误:语法错误,意外'{',期待'('帮忙?

我正在尝试为快速引擎制作一个照片库插件,但它给了我这个错误,一切似乎都关闭了.有帮助吗?

$whats_gonna_happen=$_GET['pictures'];

class upload_pictures
{
    public function upload_pictures
    {
        if (!isset($whats_gonna_happen))
        {
            $uploads='';
            $cout=1;
            $stuff=$this->EE->db->query('SELECT id, name FROM albums');
            $albums_list='';
            while ($row=$stuff->result_array())
            {
                $albums_list .= "<option value=" . $row[0] . ">" . $row[1] . "</option>\n";
            }  
            mysql_free_result($stuff);
            echo '
            <html>
                <head><title>Pictures upload</title></head>
                <body>
                    <form enctype="multipart/form-data" action="upload_page.php?pictures=1" method="POST" name="stough">
                        <table width="90%" border="0" align="center" style="width: 90%">
                            <tr><td>
                                Choose album : 
                                <select name="albums">
                                ' . $albums_list . '
                                </select>
                            </td></tr>
                            <tr><td>
                                <br /> photo : <br />
                                <input type="file" name="filename"  />
                            </td></tr>
                            <tr><td> …
Run Code Online (Sandbox Code Playgroud)

php parse-error

0
推荐指数
1
解决办法
687
查看次数

从方程式中导出实例时,Haskell"模式中的解析错误"

我正在学习Haskell的帮助下"为了大好的学习你的Haskell!" 我目前正在尝试了解类型类和实例.LYAH提供了一个示例,其中调用的类型TrafficLight定义如下:

data TrafficLight = Red | Yellow | Green
Run Code Online (Sandbox Code Playgroud)

现在TrafficLight应该是Eq显示以下行为的实例:

instance Eq TrafficLight where
    Red == Red = True
    Green == Green = True
    Yellow == Yellow = True
    _ == _ = False
Run Code Online (Sandbox Code Playgroud)

为了理解它是如何工作的,我写我叫自己的文件Shop.hs,我试图重写的行为Eq对我ItemSlot.

module Shop where

type Number = Int

data Item =
          BellPepper
        | Cabbage
        | Carrot
        | Lettuce
        | Onion
        | Potato
        | Tomato
        deriving (Show, Read, Eq)

data ItemSlot = …
Run Code Online (Sandbox Code Playgroud)

haskell parse-error

0
推荐指数
1
解决办法
821
查看次数

获取解析错误:语法错误,PHP中意外的T_LNUMBER?

我试图将序列化值插入ac_services表但收到错误:

语法错误,第559行的C:\ wamp\www\db-setup\steps\db-install-script.php中的意外T_LNUMBER

$insert_ac_services = "

INSERT INTO `ac_services` 
( `id` , `name` , `desc` , `duration` , `unit` , `paddingtime` , `cost` , `capacity` , `availability` , `business_id` , `category_id` , `staff_id` ) 
VALUES 
( 1, 'Default', 'this is default service.', 30, 'minute', 10, 15, 1, 'yes', 0, 0, 'a:1:{i:0;s:2:"1";}' ) ;
";

mysql_query($insert_ac_services);
Run Code Online (Sandbox Code Playgroud)

我通过phpmyadmin生成了这个php查询.但不工作,有什么建议吗?谢谢...

php database phpmyadmin parse-error

0
推荐指数
1
解决办法
7842
查看次数

C++模板解析错误

可能重复:
我必须在何处以及为何要使用"template"和"typename"关键字?

test在类中有一个静态模板方法,A它接受一个bool模板参数.当我尝试像这样调用函数时:

x = A::test<true>(...);
Run Code Online (Sandbox Code Playgroud)

解析器抱怨,因为它将<less视为小于运算符.我怎样才能告诉编译器这是一个模板实例而不是一个oprator呢?

c++ parsing templates parse-error

0
推荐指数
1
解决办法
819
查看次数

GLSL语法错误:"in"解析错误

我正在尝试在我的程序中使用着色器,但我得到了非常奇怪的错误...

Vertex shader failed to compile with the following error
ERROR: 0:6: error(#132) Syntax error: "in" parse error
ERROR: error(#273) 1 compilation errors.  No code generated
Run Code Online (Sandbox Code Playgroud)

我认为问题在于文件读取,但在尝试了很多方法后,它仍然无法正常工作.

所以这是我的代码:

bool ShaderProgram::LoadShaderFile(const char* shader_path, GLuint& shader_id)
{
    ifstream oFileStream(shader_path);
    if(oFileStream)
    {
        // Load shader code
        string sShaderSource;
        sShaderSource.assign((istreambuf_iterator<char> (oFileStream) ), istreambuf_iterator<char> () );

        // Forward shader code to OGL
        const GLchar* chShaderSource = sShaderSource.c_str() + '\0';
        printf("%s", chShaderSource);
        glShaderSource(shader_id, 1, (const GLchar**) &chShaderSource, NULL);


        return true;
    }
    else
        return false;

}
Run Code Online (Sandbox Code Playgroud)

我的着色器: …

c++ opengl shader glsl parse-error

0
推荐指数
1
解决办法
2894
查看次数

解析模式中的错误:xs - 理解

我在haskell中有以下两个函数:

plusList :: [[Int]] -> [Int]
plusList [xs ys] = add xs + plusList [ys]
plusList [[]] = 0


add::[Int] -> Int
add (x:xs) = x + add xs
add [] = 0
Run Code Online (Sandbox Code Playgroud)

所以,我认为我在plusList [xs ys] =添加xs + plusList ys中有错误

我的想法是通过设置集合,即[[Int]],通过取第一个List xs,在其上应用"add",然后用"plusList ys"递归调用第二个列表ys

我是哈斯克尔的新手,我可以这样做吗?如果不是,为什么?

haskell pattern-matching parse-error

0
推荐指数
1
解决办法
106
查看次数

输入'< - '上的解析错误:Haskell

我正在从用户那里获取输入,代码如下:

putStrLn $ "Enter number"
num <- getLine
main = print $ num
Run Code Online (Sandbox Code Playgroud)

当我运行此代码时,编译器会出现以下错误:

ra.hs:10:5: parse error on input `<-'
Run Code Online (Sandbox Code Playgroud)

如何删除此错误?我试图使用空格,以及制表符,但错误仍然存​​在.请帮忙.

haskell parse-error

0
推荐指数
1
解决办法
152
查看次数

初学者遇到Haskell语法问题

所以到目前为止我只使用Haskell进行简单的教程,下面的代码给我一个"解析错误"......我知道这与我的语法有关但我不知道是什么

 --ternarySearch
  7 ternarySearch :: (Float -> Float) -> Float -> Float -> Float -> Float
  8 ternarySearch f a b tau = do 
  9                         if (abs(b-a) < tau)
 10                           then return ((a+b)/2)
 11                         c = (a + (b-a)/3)
 12                         d = (b - (b-a)/3)
 13                         if f(c) < f(d)
 14                           then return (ternarySearch f c b tau)
 15                         else return (ternarySearch f a d tau)
Run Code Online (Sandbox Code Playgroud)

我得到的错误是:

ternary.hs:11:25: parse error on input `c'
Run Code Online (Sandbox Code Playgroud)

有任何想法吗?

syntax haskell parse-error

0
推荐指数
1
解决办法
81
查看次数

为什么打印类型信息需要括号.?

要打印.我使用的类型信息:

?> :type (.)
(.) :: (b -> c) -> (a -> b) -> a -> c
Run Code Online (Sandbox Code Playgroud)

如果我省略括号,会导致错误:

?> :type .
<interactive>:1:1: parse error on input ‘.’
Run Code Online (Sandbox Code Playgroud)

其他类型的情况也是如此:

?> :type 1
1 :: Num a => a
?> :type (1)
(1) :: Num a => a
?> :type True 
True :: Bool
?> :type (True)
(True) :: Bool
Run Code Online (Sandbox Code Playgroud)

为什么特殊行为.

syntax haskell parse-error

0
推荐指数
1
解决办法
80
查看次数